DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Joshua Washington <joshwash@google.com>,
	Junfeng Guo <junfengg@nvidia.com>,
	Xiaoyun Li <xiaoyun.li@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org,
	 "Jasper Tran O'Leary" <jtranoleary@google.com>
Subject: [PATCH 03/12] net/gve: fix integer underflow in GQI Rx path
Date: Thu,  3 Dec 2026 15:26:26 -0800	[thread overview]
Message-ID: <20261203232637.1044501-4-joshwash@google.com> (raw)
In-Reply-To: <20261203232637.1044501-1-joshwash@google.com>

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@dpdk.org

Signed-off-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Jasper Tran O'Leary <jtranoleary@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


  parent reply	other threads:[~2026-12-03 23:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 23:26 [PATCH 00/12] net/gve: stability fixes and DQO scattered Rx support Joshua Washington
2026-12-03 23:26 ` [PATCH 01/12] net/gve: disable queue start and stop Joshua Washington
2026-12-03 23:26 ` [PATCH 02/12] net/gve: free partially received GQI Rx packet Joshua Washington
2026-12-03 23:26 ` Joshua Washington [this message]
2026-12-03 23:26 ` [PATCH 04/12] net/gve: fix integer truncation in GQI QPL Tx path Joshua Washington
2026-12-03 23:26 ` [PATCH 05/12] net/gve: do not count unsent DQO Tx packets as oerrors Joshua Washington
2026-12-03 23:26 ` [PATCH 06/12] net/gve: disable unsupported TCP LRO offload Joshua Washington
2026-12-03 23:26 ` [PATCH 07/12] net/gve: drop multi-seg Rx packets if scatter is off Joshua Washington
2026-12-03 23:26 ` [PATCH 08/12] net/gve: reject non-power-of-2 ring sizes on DQO Joshua Washington
2026-12-03 23:26 ` [PATCH 09/12] net/gve: properly handle RSS realloc failures Joshua Washington
2026-12-03 23:26 ` [PATCH 10/12] net/gve: reject unsupported flow attributes and item masks Joshua Washington
2026-12-03 23:26 ` [PATCH 11/12] net/gve: fix mbuf leak on GQI Rx queue start Joshua Washington
2026-12-03 23:26 ` [PATCH 12/12] net/gve: support scattered Rx for DQO Joshua Washington
2026-12-04 19:13 ` [PATCH 00/12] net/gve: stability fixes and DQO scattered Rx support Stephen Hemminger

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=20261203232637.1044501-4-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=dev@dpdk.org \
    --cc=jtranoleary@google.com \
    --cc=junfengg@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=xiaoyun.li@intel.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