crypto/virtio: check for invalid IOVA address
Checks
Commit Message
This change fixes coverity issue on overflowed constant.
Bad phys address should be checked before using it in
descriptor.
Coverity issue: 457462, 457465
Fixes: 10702138f1a ("crypto/virtio: support asymmetric RSA")
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
drivers/crypto/virtio/virtio_cryptodev.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
> This change fixes coverity issue on overflowed constant.
> Bad phys address should be checked before using it in
> descriptor.
>
> Coverity issue: 457462, 457465
> Fixes: 10702138f1a ("crypto/virtio: support asymmetric RSA")
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Cc: stable@dpdk.org
Acked-by: Akhil Goyal <gakhil@marvell.com>
Applied to dpdk-next-crypto
Thanks
@@ -799,6 +799,10 @@ virtio_crypto_clear_session(
}
malloc_phys_addr = rte_malloc_virt2iova(ctrl);
+ if (malloc_phys_addr == RTE_BAD_IOVA) {
+ VIRTIO_CRYPTO_SESSION_LOG_ERR("malloc_phys_addr is invalid");
+ return;
+ }
/* status part */
status = &(((struct virtio_crypto_inhdr *)
@@ -916,6 +920,10 @@ virtio_crypto_clear_session_packed(
}
malloc_phys_addr = rte_malloc_virt2iova(ctrl);
+ if (malloc_phys_addr == RTE_BAD_IOVA) {
+ VIRTIO_CRYPTO_SESSION_LOG_ERR("malloc_phys_addr is invalid");
+ return;
+ }
/* status part */
status = &(((struct virtio_crypto_inhdr *)