[PATCH 03/12] net/gve: fix integer underflow in GQI Rx path
Joshua Washington
joshwash at google.com
Fri Dec 4 00:26:26 CET 2026
In gve_rx(), GVE_RX_PAD is unconditionally subtracted from frag_size on
the first fragment of a packet without verifying that frag_size is at
least GVE_RX_PAD. If the descriptor reports a length smaller than
GVE_RX_PAD, the uint16_t subtraction underflows, causing an
out-of-bounds copy in gve_rx_mbuf() when operating in QPL mode.
Check that frag_size >= GVE_RX_PAD on the first fragment before
subtracting. If it is smaller, log an error, mark the packet to be
dropped, increment rxq->stats.errors, and jump to drop_frag.
Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Cc: stable at dpdk.org
Signed-off-by: Joshua Washington <joshwash at google.com>
Reviewed-by: Jasper Tran O'Leary <jtranoleary at google.com>
---
drivers/net/gve/gve_rx.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
index 8e7557e774..1985e9ad02 100644
--- a/drivers/net/gve/gve_rx.c
+++ b/drivers/net/gve/gve_rx.c
@@ -156,8 +156,16 @@ gve_rx(struct gve_rx_queue *rxq, volatile struct gve_rx_desc *rxd, uint16_t rx_i
goto drop_frag;
}
- if (is_first_frag)
+ if (is_first_frag) {
+ if (unlikely(frag_size < GVE_RX_PAD)) {
+ PMD_DRV_DP_LOG(ERR, "Rx fragment size (%u) smaller than padding (%u)",
+ frag_size, GVE_RX_PAD);
+ ctx->drop_pkt = true;
+ rxq->stats.errors++;
+ goto drop_frag;
+ }
frag_size -= GVE_RX_PAD;
+ }
rxe = rxq->sw_ring[rx_id];
gve_rx_mbuf(rxq, rxe, frag_size, rx_id);
--
2.56.1.915.g69d5ec7298-goog
More information about the stable
mailing list