summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorMarian Chereji <marian.chereji@freescale.com>2013-09-10 11:06:23 (GMT)
committerJ. German Rivera <German.Rivera@freescale.com>2013-09-10 23:45:12 (GMT)
commitd0f7e3373ecdb9a5f154f2c2d4ba0eba953af3ef (patch)
tree2da42fa69eea667c2a247e171bc8a96fbee233e8 /drivers/staging
parent25596a1c0ad9dcd6e4948fbc9246ae394750e49e (diff)
downloadlinux-fsl-qoriq-d0f7e3373ecdb9a5f154f2c2d4ba0eba953af3ef.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')
-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;
}