summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_dpa_offload
diff options
context:
space:
mode:
authorMarian Chereji <marian.chereji@freescale.com>2013-09-10 11:06:23 (GMT)
committerRivera Jose-B46482 <German.Rivera@freescale.com>2013-09-10 23:28:19 (GMT)
commitb4c09b0e1b90905d69903c666f0a2552a065d434 (patch)
treec9e28f72c917671cd94030648f5500a09f0ca072 /drivers/staging/fsl_dpa_offload
parent601519a03aa9cbfacedea41d595e1ecb239430e4 (diff)
downloadlinux-fsl-qoriq-b4c09b0e1b90905d69903c666f0a2552a065d434.tar.xz
dpa_offload: Leave stats counters Ids memory allocated for asynchronous statistics requests
When the DPA Stats is processing asynchronous requests, the memory allocated for the counter Ids and fed to the processing tasklet must NOT be released in the get_counters call, because the tasklet would work on invalid memory space later on. This memory must be released only when the event which signals the completion of the async request is consumed by the user space. Signed-off-by: Marian Chereji <marian.chereji@freescale.com> Change-Id: I49481a244305fb468781d3f3b1305698b554055f Reviewed-on: http://git.am.freescale.net:8181/4562 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Zanoschi Aurelian-B43522 <Aurelian.Zanoschi@freescale.com> Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_dpa_offload')
-rw-r--r--drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
index b7fdf18..6784cf5 100644
--- a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
+++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
@@ -305,6 +305,7 @@ ssize_t wrp_dpa_stats_read(struct file *file,
return -EFAULT;
}
+ kfree(event->ks_cnt_ids);
kfree(event);
count -= sizeof(struct compat_dpa_stats_event_params);
@@ -356,6 +357,7 @@ ssize_t wrp_dpa_stats_read(struct file *file,
return -EFAULT;
}
+ kfree(event->ks_cnt_ids);
kfree(event);
count -= sizeof(struct dpa_stats_event_params);
@@ -1483,10 +1485,10 @@ static int do_ioctl_stats_get_counters(void *args)
log_err("Cannot copy to user the counter parameters\n");
ret = -EINVAL;
}
- }
- /* Request was sent, release the array of counter ids */
- kfree(prm.req_params.cnts_ids);
+ /* Request was sent, release the array of counter ids */
+ kfree(prm.req_params.cnts_ids);
+ }
return ret;
}
@@ -1579,9 +1581,10 @@ static int do_ioctl_stats_compat_get_counters(void *args)
log_err("Cannot copy to user the counter parameters\n");
ret = -EINVAL;
}
+
+ /* Request was sent, release the array of counter ids */
+ kfree(kprm.req_params.cnts_ids);
}
- /* Request was sent, release the array of counter ids */
- kfree(kprm.req_params.cnts_ids);
return ret;
}