From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>, Jay Zhou <jianjay.zhou@huawei.com>,
"Gowrishankar Muthukrishnan" <gmuthukrishn@marvell.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: <anoobj@marvell.com>
Subject: [PATCH] crypto/virtio: check for invalid IOVA address
Date: Thu, 15 May 2025 13:33:10 +0530 [thread overview]
Message-ID: <20250515080313.1612-1-gmuthukrishn@marvell.com> (raw)
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
reply other threads:[~2025-05-15 8:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250515080313.1612-1-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jianjay.zhou@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).