Skip to contentSkip to conversation

net/iavf: reject oversized frames in prep callback

PATCH Applied Ciara Loftus 2 participants 2 messages Jun 9 – Jun 11 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: reject oversized frames in prep callback

Currently, only the segment count is checked for non-TSO packets. There is no upper bound placed on the packet length, so packets larger than IAVF_FRAME_SIZE_MAX pass the prepare callback unchallenged and are submitted to the hardware. Sending such frames can trigger Malicious Driver Detection (MDD) on the PF. Fix this by adding a packet length size check on the non-TSO path.

Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")
---
 drivers/net/intel/iavf/iavf_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +2 -2
index decbc75142..a57af7faed 100644
@@ -3227,9 +3227,9 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 		m = tx_pkts[i];
 		ol_flags = m->ol_flags;
 
-		/* Check condition for nb_segs > IAVF_TX_MAX_MTU_SEG. */
+		/* Validate segment count and packet length. */
 		if (!(ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))) {
-			if (m->nb_segs > IAVF_TX_MAX_MTU_SEG) {
+			if (m->nb_segs > IAVF_TX_MAX_MTU_SEG || m->pkt_len > IAVF_FRAME_SIZE_MAX) {
 				rte_errno = EINVAL;
 				return i;
 			}
Signature · 1 line
2.43.0
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 7 lines · Ciara Loftus

Currently, only the segment count is checked for non-TSO packets. There is no upper bound placed on the packet length, so packets larger than IAVF_FRAME_SIZE_MAX pass the prepare callback unchallenged and are submitted to the hardware. Sending such frames can trigger Malicious Driver Detection (MDD) on the PF. Fix this by adding a packet length size check on the non-TSO path.

Quoted 5 lines
Fixes 19ee91c6bd9a ("net/iavf: check illegal packet sizes")

---

Applied to dpdk-next-net-intel.
Thanks,
/Bruce