[v2] crypto/virtio: fix out of bounds access bug
Checks
Commit Message
Coverity flags an untrusted loop bound. Check length of session iv.
Coverity issue: 375802
Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
Cc: roy.fan.zhang@intel.com
Cc: stable@dpdk.org
Signed-off-by: Brian Dooley <brian.dooley@intel.com>
---
v2: Fix checkpatch warning
---
drivers/crypto/virtio/virtio_rxtx.c | 3 +++
1 file changed, 3 insertions(+)
Comments
> -----Original Message-----
> From: Dooley, Brian <brian.dooley@intel.com>
> Sent: Tuesday, February 22, 2022 9:55 AM
> To: dev@dpdk.org
> Cc: Dooley, Brian <brian.dooley@intel.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; stable@dpdk.org; Jay Zhou
> <jianjay.zhou@huawei.com>
> Subject: [PATCH v2] crypto/virtio: fix out of bounds access bug
>
> Coverity flags an untrusted loop bound. Check length of session iv.
>
> Coverity issue: 375802
>
> Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
> Cc: roy.fan.zhang@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Brian Dooley <brian.dooley@intel.com>
>
> ---
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> -----Original Message-----
> From: Dooley, Brian <brian.dooley@intel.com>
> Sent: Tuesday, February 22, 2022 9:55 AM
> To: dev@dpdk.org
> Cc: Dooley, Brian <brian.dooley@intel.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; stable@dpdk.org; Jay Zhou
> <jianjay.zhou@huawei.com>
> Subject: [PATCH v2] crypto/virtio: fix out of bounds access bug
>
> Coverity flags an untrusted loop bound. Check length of session iv.
>
> Coverity issue: 375802
>
> Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
> Cc: roy.fan.zhang@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Brian Dooley <brian.dooley@intel.com>
>
> ---
Reacking as the last ack not shown in patchwork
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> > Coverity flags an untrusted loop bound. Check length of session iv.
> >
> > Coverity issue: 375802
> >
> > Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
> > Cc: roy.fan.zhang@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Brian Dooley <brian.dooley@intel.com>
> >
> > ---
> Reacking as the last ack not shown in patchwork
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-crypto
Thanks.
@@ -264,6 +264,9 @@ virtqueue_crypto_sym_enqueue_xmit(
if (cop->phys_addr)
desc[idx].addr = cop->phys_addr + session->iv.offset;
else {
+ if (session->iv.length > VIRTIO_CRYPTO_MAX_IV_SIZE)
+ return -ENOMEM;
+
rte_memcpy(crypto_op_cookie->iv,
rte_crypto_op_ctod_offset(cop,
uint8_t *, session->iv.offset),