mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] idpf: free the skb on TX DMA mapping errors
@ 2026-10-24  3:04 Mina Almasry
  2026-10-24  3:05 ` netdev-bot+sinfo
  2026-10-25  3:04 ` netdev-bot+sashiko
  0 siblings, 2 replies; 4+ messages in thread
From: Mina Almasry @ 2026-10-24  3:04 UTC (permalink / raw)
  To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel, netdev, linux-kernel
  Cc: Naman Gulati, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Mina Almasry

From: Naman Gulati <namangulati@google.com>

When a DMA mapping fails in idpf_tx_splitq_map() or
idpf_tx_singleq_map(), the unwind walks the buffers with
libeth_tx_complete(). The first buffer is still typed LIBETH_SQE_FRAG
(or LIBETH_SQE_EMPTY if the linear data mapping itself failed) at that
point, so it is only unmapped and the skb is never freed. The callers
return NETDEV_TX_OK and do not touch the skb either, so it leaks.

Free the skb at the end of the unwind.

Fixes: d9028db618a6 ("idpf: convert to libeth Tx buffer completion")
Signed-off-by: Naman Gulati <namangulati@google.com>
Signed-off-by: Mina Almasry <almasrymina@google.com>
---
 drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c | 2 ++
 drivers/net/ethernet/intel/idpf/idpf_txrx.c         | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
index e3ddf18dcbf51..010903260ff6f 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
@@ -228,6 +228,8 @@ static void idpf_tx_singleq_dma_map_error(struct idpf_tx_queue *txq,
 
 	/* Update tail in case netdev_xmit_more was previously true */
 	idpf_tx_buf_hw_update(txq, idx, false);
+
+	dev_kfree_skb_any(skb);
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 885df6294ad94..a92e2457781e6 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -2606,6 +2606,7 @@ static void idpf_tx_splitq_pkt_err_unmap(struct idpf_tx_queue *txq,
 	struct idpf_sw_queue *refillq = txq->refillq;
 	struct libeth_sq_napi_stats ss = { };
 	struct idpf_tx_buf *tx_buf = first;
+	struct sk_buff *skb = first->skb;
 	struct libeth_cq_pp cp = {
 		.dev    = txq->dev,
 		.ss     = &ss,
@@ -2621,6 +2622,8 @@ static void idpf_tx_splitq_pkt_err_unmap(struct idpf_tx_queue *txq,
 		libeth_tx_complete(tx_buf, &cp);
 	}
 
+	dev_kfree_skb_any(skb);
+
 	/* Update tail in case netdev_xmit_more was previously true. */
 	idpf_tx_buf_hw_update(txq, params->prev_ntu, false);
 

base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
-- 
2.56.0.257.gf7497c7d27-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-25  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-24  3:04 [PATCH net] idpf: free the skb on TX DMA mapping errors Mina Almasry
2026-10-24  3:05 ` netdev-bot+sinfo
2026-10-24  3:09   ` Mina Almasry
2026-10-25  3:04 ` netdev-bot+sashiko

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®