From: Wentao Liang <vulab@iscas.ac.cn>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, vulab@iscas.ac.cn
Subject: [PATCH net v2] net: cxgb: Fix skb reference leak in ESPI workaround timers
Date: Sun, 08 Nov 2026 10:34:53 -0000 [thread overview]
Message-ID: <20261108101200.2147806-1-vulab@iscas.ac.cn> (raw)
From: Wentao Liang <vulab@iscas.ac.cn>
Date: Sun, 8 Nov 2026 10:09:23 +0000
Subject: [PATCH net v2] net: cxgb: Fix skb reference leak in ESPI workaround
timers
espibug_workaround_t204() and espibug_workaround() take an extra
reference with skb_get() on the cached ARP skb before handing it to
t1_sge_tx(), so that the skb survives until the DMA has completed.
When the command queue is full, t1_sge_tx() returns NETDEV_TX_BUSY
without queueing the skb, and both callers ignore the return value, so
the extra reference is never dropped.
Drop the extra reference when t1_sge_tx() reports that it did not consume
the skb.
The candidate was found with static analysis tools; DeepSeek and GPT-6.1
Sol were used to audit it and to help prepare this fix.
Fixes: f1d3d38af757 ("[PATCH] chelsio: add support for other 10G boards")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
Changes in v2:
- Also fix the same leaked reference in espibug_workaround(), the
single-port T2 timer callback, which has the identical pattern.
- Apologies for the very late respin; v1 was sent in a batch that went
well over the netdev posting limits.
- Dropped Cc: stable@vger.kernel.org. This only leaks a reference on an
error path in an old driver, so I leave the backport decision to you.
- Rebased on current mainline (fa4ad798f6f6). Build-tested on x86_64
with W=1 (CONFIG_CHELSIO_T1=m): the cxgb module builds without warnings
and checkpatch.pl is clean. The NETDEV_TX_BUSY path was not exercised
at runtime.
- Link to v1: https://lore.kernel.org/all/20260917105425.2147804-1-vulab@iscas.ac.cn/
drivers/net/ethernet/chelsio/cxgb/sge.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c
index d8fca697874a..87e6dbcc3ed7 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -2052,7 +2052,8 @@ static void espibug_workaround_t204(struct timer_list *t)
* the skb once the DMA has completed.
*/
skb = skb_get(skb);
- t1_sge_tx(skb, adapter, 0, adapter->port[i].dev);
+ if (t1_sge_tx(skb, adapter, 0, adapter->port[i].dev))
+ dev_kfree_skb_any(skb);
}
}
mod_timer(&sge->espibug_timer, jiffies + sge->espibug_timeout);
@@ -2084,7 +2085,8 @@ static void espibug_workaround(struct timer_list *t)
* skb once the DMA has completed.
*/
skb = skb_get(skb);
- t1_sge_tx(skb, adapter, 0, adapter->port[0].dev);
+ if (t1_sge_tx(skb, adapter, 0, adapter->port[0].dev))
+ dev_kfree_skb_any(skb);
}
}
mod_timer(&sge->espibug_timer, jiffies + sge->espibug_timeout);
--
2.34.1
reply other threads:[~2026-11-08 10:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261108101200.2147806-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®