From: Wentao Liang 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 --- 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