patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Brian Dooley <brian.dooley@intel.com>
To: dev@dpdk.org
Cc: Brian Dooley <brian.dooley@intel.com>,
	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
Date: Tue, 22 Feb 2022 09:54:51 +0000	[thread overview]
Message-ID: <20220222095451.731405-1-brian.dooley@intel.com> (raw)
In-Reply-To: <20220221180542.439823-1-brian.dooley@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>

---
v2: Fix checkpatch warning
---
 drivers/crypto/virtio/virtio_rxtx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/crypto/virtio/virtio_rxtx.c b/drivers/crypto/virtio/virtio_rxtx.c
index a65524a306..08359b3a39 100644
--- a/drivers/crypto/virtio/virtio_rxtx.c
+++ b/drivers/crypto/virtio/virtio_rxtx.c
@@ -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),
-- 
2.25.1


       reply	other threads:[~2022-02-22  9:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220221180542.439823-1-brian.dooley@intel.com>
2022-02-22  9:54 ` Brian Dooley [this message]
2022-02-23 10:58   ` Zhang, Roy Fan
2022-02-23 11:10   ` Zhang, Roy Fan
2022-02-23 11:12     ` Akhil Goyal

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=20220222095451.731405-1-brian.dooley@intel.com \
    --to=brian.dooley@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianjay.zhou@huawei.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=stable@dpdk.org \
    /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).