🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Wentao Liang Wed, 04 Nov 2026 02:53
[PATCH] net: stmmac: unwind the XSK pool when the initial wakeup fails
#10769
Author: Wentao Liang
Date: Wed, 04 Nov 2026 02:53
47 lines
9795 bytes
stmmac_xdp_enable_pool() maps the XSK pool, reconfigures the queue for
zero-copy and only then wakes the RX NAPI. If that wakeup fails, for
example because the carrier dropped while the queue was being
reinitialized, the function returns an error without unmapping the
pool or restoring the queue. The mapping and its netdev reference are
then leaked, and the queue keeps a pointer to a pool that the caller is
about to destroy.

Roll the queue back to its non-zero-copy state through
stmmac_xdp_disable_pool(), which also drops the DMA mapping.

Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
index 9af9e0cb366c..4b18f03dddc9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
@@ -6,6 +6,8 @@
 #include "stmmac.h"
 #include "stmmac_xdp.h"
 
+static int stmmac_xdp_disable_pool(struct stmmac_priv *priv, u16 queue);
+
 static int stmmac_xdp_enable_pool(struct stmmac_priv *priv,
 				  struct xsk_buff_pool *pool, u16 queue)
 {
@@ -48,8 +50,10 @@ static int stmmac_xdp_enable_pool(struct stmmac_priv *priv,
 		napi_enable(&ch->rxtx_napi);
 
 		err = stmmac_xsk_wakeup(priv->dev, queue, XDP_WAKEUP_RX);
-		if (err)
+		if (err) {
+			stmmac_xdp_disable_pool(priv, queue);
 			return err;
+		}
 	}
 
 	return 0;
-- 
2.34.1
Re: [PATCH] net: stmmac: unwind the XSK pool when the initial wakeup fails
#10768
Author: netdev-bot+sinfo
Date: Wed, 04 Nov 2026 02:58
26 lines
9275 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by code inspection). If it was triggered please include
   the symptoms, like the stack trace or error messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Re: [PATCH] net: stmmac: unwind the XSK pool when the initial wakeup fails
#10782
Author: Andrew Lunn
Date: Wed, 04 Nov 2026 04:12
10 lines
8800 bytes
> +static int stmmac_xdp_disable_pool(struct stmmac_priv *priv, u16 queue);

Never add forward declarations in the kernel, move the code needed
before it is called.

    Andrew

---
pw-bot: cr
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads