summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorRadu Bulie <radu.bulie@freescale.com>2014-09-18 14:53:21 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:39:35 (GMT)
commit17f24f450c3c3d93c1bea3481bba3fadc1afc1df (patch)
treec0090d1fb8a1237d7ccf8beaf1370539de0ef7d2 /drivers/staging
parenta6ef2838a2fe289be7d9f9eb864701250153153b (diff)
downloadlinux-fsl-qoriq-17f24f450c3c3d93c1bea3481bba3fadc1afc1df.tar.xz
dpa_offload: Add check for initialization vector
This patch adds a check for the maximum value of the IV provided to an outbound SA. Change-Id: I102aeb893100222171103a738f0bfa20ed17f33c Signed-off-by: Radu Bulie <radu.bulie@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/19121 Reviewed-by: Marian-Cornel Chereji <marian.chereji@freescale.com> Tested-by: Marian-Cornel Chereji <marian.chereji@freescale.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c
index 34747d6..ddff1ba 100644
--- a/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c
+++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_ipsec.c
@@ -411,6 +411,15 @@ static int do_copy_sa_params(struct dpa_ipsec_sa_params *prm, void *args)
kfree(sa_out_iv);
return err;
}
+
+ if (sa_out_iv->length > DPA_IPSEC_MAX_IV_LEN) {
+ err = -EINVAL;
+ log_err("Error - IV length greater than %d\n",
+ DPA_IPSEC_MAX_IV_LEN);
+ kfree(sa_out_iv);
+ return err;
+ }
+
sa_out_prm->init_vector = sa_out_iv;
/* if the IV array is NULL, don't bother to copy it */