Skip to contentSkip to conversation

crypto/virtio: fix out of bounds access bug

PATCH Superseded Brian Dooley 3 participants 5 messages Feb 21, 2022 – Feb 23, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/crypto/virtio/virtio_rxtx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/crypto/virtio/virtio_rxtx.c +3 -0
index a65524a306..f3f2e75c00 100644
@@ -264,6 +264,9 @@ virtqueue_crypto_sym_enqueue_xmit(
 		if (cop->phys_addr)
 			desc[idx].addr = cop->phys_addr + session->iv.offset;
 		else {
+			if (VIRTIO_CRYPTO_MAX_IV_SIZE < session->iv.length)
+				return -ENOMEM;
+
 			rte_memcpy(crypto_op_cookie->iv,
 					rte_crypto_op_ctod_offset(cop,
 					uint8_t *, session->iv.offset),
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 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")

---
v2: Fix checkpatch warning

---
 drivers/crypto/virtio/virtio_rxtx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/crypto/virtio/virtio_rxtx.c +3 -0
index a65524a306..08359b3a39 100644
@@ -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),
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#2 lore raw
Quoted 13 lines

-----Original Message-----
From: Dooley, Brian <[email protected]>
Sent: Tuesday, February 22, 2022 9:55 AM
To: [email protected]
Cc: Dooley, Brian <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]; Jay Zhou <[email protected]>
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

Quoted 7 lines
Fixes b063e843fa03 ("crypto/virtio: fix IV physical address")

---

Acked-by on v2 1/1
#3 lore raw
In reply to Brian Dooley
Quoted 13 lines

-----Original Message-----
From: Dooley, Brian <[email protected]>
Sent: Tuesday, February 22, 2022 9:55 AM
To: [email protected]
Cc: Dooley, Brian <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]; Jay Zhou <[email protected]>
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

Quoted 7 lines
Fixes b063e843fa03 ("crypto/virtio: fix IV physical address")

---

Reacking as the last ack not shown in patchwork