All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Jeroen de Borst <jeroendb@google.com>,
	Joshua Washington <joshwash@google.com>,
	 Xiaoyun Li <xiaoyun.li@intel.com>,
	Junfeng Guo <junfengg@nvidia.com>,
	 Rushil Gupta <rushilg@google.com>
Cc: dev@dpdk.org, stable@dpdk.org,
	 "Jasper Tran O'Leary" <jtranoleary@google.com>
Subject: [PATCH 5/9] net/gve: set mbuf to null in software ring after use
Date: Wed,  1 Jul 2026 11:35:23 -0700	[thread overview]
Message-ID: <20260701183528.2443032-6-joshwash@google.com> (raw)
In-Reply-To: <20260701183528.2443032-1-joshwash@google.com>

Currently, it is possible for mbufs to be uncleared in the sw_ring after
being returned to the application. This causes an erroneous
dual-ownership over the buffer until GVE cleans the buffer queue and
posts new mbufs, overwriting the older pointers. It is possible in such
a case for a double free to occur while tearing down rings, as both
the application and the driver could attempt to free the same mbuf.
Release ownership of the mbuf from the sw_ring as soon as appropriate to
avoid such a scenario.

Fixes: a46583cf43c8 ("net/gve: support Rx/Tx")
Fixes: 45da16b5b181 ("net/gve: support basic Rx data path for DQO")
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     | 1 +
 drivers/net/gve/gve_rx_dqo.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/gve/gve_rx.c b/drivers/net/gve/gve_rx.c
index 625649cdcf..cda87af294 100644
--- a/drivers/net/gve/gve_rx.c
+++ b/drivers/net/gve/gve_rx.c
@@ -152,6 +152,7 @@ gve_rx(struct gve_rx_queue *rxq, volatile struct gve_rx_desc *rxd, uint16_t rx_i

 	rxe = rxq->sw_ring[rx_id];
 	gve_rx_mbuf(rxq, rxe, frag_size, rx_id);
+	rxq->sw_ring[rx_id] = NULL;
 	rxq->stats.bytes += frag_size;

 	if (is_first_frag) {
diff --git a/drivers/net/gve/gve_rx_dqo.c b/drivers/net/gve/gve_rx_dqo.c
index c4e2d32067..3665d9e4cd 100644
--- a/drivers/net/gve/gve_rx_dqo.c
+++ b/drivers/net/gve/gve_rx_dqo.c
@@ -207,6 +207,7 @@ gve_rx_burst_dqo(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)

 		rxm = rxq->sw_ring[rx_buf_id];
 		gve_completed_buf_list_push(rxq, rx_buf_id);
+		rxq->sw_ring[rx_buf_id] = NULL;

 		/* Free buffer and report error. */
 		if (unlikely(rx_desc->rx_error)) {
--
2.55.0.rc0.799.gd6f94ed593-goog


  parent reply	other threads:[~2026-07-01 18:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 18:35 [PATCH 0/9] Stability fixes for GVE Joshua Washington
2026-07-01 18:35 ` [PATCH 1/9] net/gve: clear out shared memory region for stats report Joshua Washington
2026-07-01 18:35 ` [PATCH 2/9] net/gve: delay adding mbuf head to software ring Joshua Washington
2026-07-01 18:35 ` [PATCH 3/9] net/gve: copy data to QPL buffer when mbuf read does not Joshua Washington
2026-07-01 18:35 ` [PATCH 4/9] net/gve: validate buf ID before processing Rx packet Joshua Washington
2026-07-01 18:35 ` Joshua Washington [this message]
2026-07-01 18:35 ` [PATCH 6/9] net/gve: free ctx mbuf if packet dropped after first segment Joshua Washington
2026-07-01 18:35 ` [PATCH 7/9] net/gve: increase range of DMA memzone ids to 64 bits Joshua Washington
2026-07-01 18:35 ` [PATCH 8/9] net/gve: don't reset ring size bounds to default on reset Joshua Washington
2026-07-01 18:35 ` [PATCH 9/9] net/gve: restrict max ring size in GQ QPL to 2K Joshua Washington
2026-07-01 18:50 ` [PATCH 0/9] Stability fixes for GVE Stephen Hemminger
2026-07-01 19:59   ` Joshua Washington
2026-07-03  4:36     ` 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=20260701183528.2443032-6-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=dev@dpdk.org \
    --cc=jeroendb@google.com \
    --cc=jtranoleary@google.com \
    --cc=junfengg@nvidia.com \
    --cc=rushilg@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.