From 2caf0b68157701a12145db5f6d60fce1650c9389 Mon Sep 17 00:00:00 2001 From: Marian Chereji Date: Fri, 27 Sep 2013 16:48:31 +0300 Subject: dpa_offload: Propagate error code when IPSec module fails to recognize ioctl command IPSec module used to silently fail when an ioctl command was not recognized. This may cause applications to take inconsistent (uninitialized) data as granted. Signed-off-by: Marian Chereji Change-Id: Id2ec3b0894d9d80332c279c976127c1d40345c7e Reviewed-on: http://git.am.freescale.net:8181/5038 Tested-by: Review Code-CDREVIEW Reviewed-by: Varvara Andrei-B21317 Reviewed-by: Rivera Jose-B46482 diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c index 0d3ff7e..7b51e97 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c @@ -1335,7 +1335,8 @@ free: break; } default: - pr_err("Invalid DPA IPsec ioctl\n"); + pr_err("Invalid DPA IPsec ioctl (0x%x)\n", cmd); + ret = -EINVAL; break; } @@ -1503,7 +1504,8 @@ free: break; } default: - pr_err("Invalid DPA IPsec ioctl\n"); + pr_err("Invalid DPA IPsec ioctl (0x%x)\n", cmd); + ret = -EINVAL; break; } -- cgit v0.10.2 From c47eaed207b4c979000215bf38da5ec291ccb02f Mon Sep 17 00:00:00 2001 From: Radu Bulie Date: Wed, 2 Oct 2013 10:43:33 +0000 Subject: dpa_offload: Fix double free pointer issue in DPA multicast component replic_grp_params variable would be freed a second time if the multicast group creation function failed to obtain a group handle from the FMD driver or imported from the user. The patch fixes the issue by freeing the resource, before any checks are performed on the group handle. Signed-off-by: Radu Bulie Change-Id: I547b0a2d476e1cd57aa3b561efa9a2cba99b7e3f Reviewed-on: http://git.am.freescale.net:8181/5147 Reviewed-by: Bulie Radu-Andrei-B37577 Tested-by: Review Code-CDREVIEW Reviewed-by: Marian-Cornel Chereji Reviewed-by: Rivera Jose-B46482 diff --git a/drivers/staging/fsl_dpa_offload/dpa_classifier.c b/drivers/staging/fsl_dpa_offload/dpa_classifier.c index 751dacd..0c081b9 100644 --- a/drivers/staging/fsl_dpa_offload/dpa_classifier.c +++ b/drivers/staging/fsl_dpa_offload/dpa_classifier.c @@ -7485,8 +7485,6 @@ int dpa_classif_mcast_create_group( pgroup->entries[0].used = true; pgroup->member_ids[0] = 0; pgroup->num_members++; - - kfree(replic_grp_params); } else { pgroup->group = res->group_node; /* mark prefilled members in index array member */ @@ -7499,6 +7497,8 @@ int dpa_classif_mcast_create_group( pgroup->num_members = group_params->prefilled_members; } + kfree(replic_grp_params); + if (!pgroup->group) { log_err("Could not create %s group %d\n", (group_params->prefilled_members > 0) ? "imported" : @@ -7524,7 +7524,6 @@ dpa_classif_mcast_create_group_error: } *grpd = DPA_OFFLD_DESC_NONE; - kfree(replic_grp_params); return err; } -- cgit v0.10.2 From e24a4496ed2c184db5cd401abbfca5f304d751c6 Mon Sep 17 00:00:00 2001 From: Anca Jeanina FLOAREA Date: Wed, 2 Oct 2013 14:22:13 +0300 Subject: dpa_offload: Fix de-allocation of uninitialized value The tbl pointer is dereference without it being previously initialized. The code should use variable cnode instead of tbl in case DPA Stats counters of type DPA_STATS_CNT_CLASSIF_NODE is being created. Signed-off-by: Anca Jeanina FLOAREA Change-Id: I10f8cd233f850c339e82d44522f2005dfb9ab27f Reviewed-on: http://git.am.freescale.net:8181/5149 Tested-by: Review Code-CDREVIEW Reviewed-by: Marian-Cornel Chereji Reviewed-by: Rivera Jose-B46482 diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c index 6784cf5..f141aa8 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c @@ -1047,7 +1047,7 @@ create_cls_counter_cleanup: kfree(cnode->keys[i]); } /* Restore user-space pointers */ - tbl->keys = us_keys; + cnode->keys = us_keys; break; case DPA_STATS_CNT_IPSEC: kfree(sa_ids); -- cgit v0.10.2 From 88e7f8f4ef514579a5e1f4eaf1e095221147f1b5 Mon Sep 17 00:00:00 2001 From: Marian Chereji Date: Wed, 2 Oct 2013 16:51:35 +0300 Subject: dpa_offload: Allow statistics enable on NEXT_TABLE classifier table entries The DPA classifier allowed the user to enable statistics only for "enqueue" and "drop" type table entries. It now allows the user to enable statistics also for the "next_table" type table entries. Change-Id: I9d57af14922170a7554431b7ba5abcaaaeac04ac Signed-off-by: Marian Chereji Reviewed-on: http://git.am.freescale.net:8181/5151 Reviewed-by: Floarea Anca Jeanina-B12569 Tested-by: Review Code-CDREVIEW Reviewed-by: Rivera Jose-B46482 diff --git a/drivers/staging/fsl_dpa_offload/dpa_classifier.c b/drivers/staging/fsl_dpa_offload/dpa_classifier.c index 0c081b9..5f7c7f7 100644 --- a/drivers/staging/fsl_dpa_offload/dpa_classifier.c +++ b/drivers/staging/fsl_dpa_offload/dpa_classifier.c @@ -2784,10 +2784,6 @@ static int action_to_next_engine_params(const struct dpa_cls_tbl_action *action, next_engine_params->nextEngine = e_FM_PCD_DONE; next_engine_params->params.enqueueParams.action = e_FM_PCD_DROP_FRAME; - if (action->enable_statistics) - next_engine_params->statisticsEn = - TRUE; - break; case DPA_CLS_TBL_ACTION_ENQ: if (distribution && classification) { @@ -2863,10 +2859,6 @@ static int action_to_next_engine_params(const struct dpa_cls_tbl_action *action, action->enq_params.new_rel_vsp_id; #endif } - - if (action->enable_statistics) - next_engine_params->statisticsEn = - TRUE; } if (action->enq_params.hmd != DPA_OFFLD_DESC_NONE) { @@ -2980,6 +2972,9 @@ static int action_to_next_engine_params(const struct dpa_cls_tbl_action *action, return -EINVAL; } + if (action->enable_statistics) + next_engine_params->statisticsEn = TRUE; + dpa_cls_dbg(("DEBUG: dpa_classifier %s (%d) <--\n", __func__, __LINE__)); -- cgit v0.10.2