diff options
author | Marian Chereji <marian.chereji@freescale.com> | 2014-05-22 09:22:17 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-22 19:18:14 (GMT) |
commit | 8dbc55b11cafe0c4e0b3aedd71902b94802dd489 (patch) | |
tree | 1c932bff5527de7592a04bdf825fc2e98f7a09b4 /drivers | |
parent | de68f6b494a95a2ead57dc9c7338a72d8aca00e7 (diff) | |
download | linux-fsl-qoriq-8dbc55b11cafe0c4e0b3aedd71902b94802dd489.tar.xz |
dpa_offload: Fix IPSec general stats issue on B4 and T platforms
The IPSec general statistics were displayed incorrectly on B4 and T
platforms because in kernel compatibility mode (32bit user space apps
combined with 64bit kernel) the DPA_IPSEC_IOC_GET_STATS message
processing was not updated with the support for multiple IPSec
instances.
Signed-off-by: Marian Chereji <marian.chereji@freescale.com>
Change-Id: I694324154ee70b9f54bdf941dfe78aa42f77823b
Reviewed-on: http://git.am.freescale.net:8181/12781
Reviewed-by: Ioana Tibuleac <ioana.tibuleac@freescale.com>
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c index d3cf32b..c07df76 100644 --- a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c +++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c @@ -1595,20 +1595,35 @@ long wrp_dpa_ipsec_do_compat_ioctl(struct file *filp, unsigned int cmd, } case DPA_IPSEC_IOC_GET_STATS: { - struct dpa_ipsec_stats ipsec_stats; + struct ioc_dpa_ipsec_instance_stats prm; - ret = dpa_ipsec_get_stats(0, &ipsec_stats); + if (copy_from_user(&prm, + (struct ioc_dpa_ipsec_instance_stats *)args, + sizeof(prm))) { + log_err("Could not copy from user stats params\n"); + return -EINVAL; + } + + if (prm.instance_id < 0) { + log_err("Invalid instance id\n"); + return -EINVAL; + } + + ret = dpa_ipsec_get_stats(prm.instance_id, &prm.stats); if (ret < 0) { - log_err("Getting stats failed\n"); + log_err("Failed to get statistics for instance %d\n", + prm.instance_id); break; } - if (copy_to_user((struct dpa_ipsec_stats *)args, - &ipsec_stats, sizeof(ipsec_stats))) { + if (copy_to_user((struct ioc_dpa_ipsec_instance_stats *)args, + &prm, sizeof(prm))) { log_err("Could not copy stats to user\n"); return -EINVAL; } break; + + } case DPA_IPSEC_IOC_SA_MODIFY: { |