* [PATCH] crypto/virtio: check for invalid IOVA address
@ 2025-05-15 8:03 Gowrishankar Muthukrishnan
0 siblings, 0 replies; only message in thread
From: Gowrishankar Muthukrishnan @ 2025-05-15 8:03 UTC (permalink / raw)
To: dev, Jay Zhou, Gowrishankar Muthukrishnan, Akhil Goyal; +Cc: anoobj
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(+)
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c
index bc737f1e68..fa215fe528 100644
--- a/drivers/crypto/virtio/virtio_cryptodev.c
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -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 *)
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-15 8:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-15 8:03 [PATCH] crypto/virtio: check for invalid IOVA address Gowrishankar Muthukrishnan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).