Netdev List
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Mina Almasry <almasrymina@google.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Naman Gulati <namangulati@google.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net] idpf: free the skb on TX DMA mapping errors
Date: Fri, 30 Oct 2026 16:36:49 +0100	[thread overview]
Message-ID: <546ce7e1-32fa-4d7e-a7d4-d6f0d5826afc@intel.com> (raw)
In-Reply-To: <03c17d6b-452a-463d-8b33-2a2aa1819ef4@intel.com>

From: Alexander Lobakin <aleksander.lobakin@intel.com>
Date: Fri, 30 Oct 2026 16:35:21 +0100

> From: Mina Almasry <almasrymina@google.com>
> Date: Sat, 24 Oct 2026 03:04:01 +0000
> 
>> 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);
> 
> libeth_tx_complete() frees the skb.
> Before this loop, it's called on @first.

Sorry, me not reading the commit messages.
If at this point, the SQE is still not `_SKB`, then

Acked-by: Alexander Lobakin <aleksander.lobakin@intel.com>

Thanks!
> 
>> +
>>  	/* Update tail in case netdev_xmit_more was previously true. */
>>  	idpf_tx_buf_hw_update(txq, params->prev_ntu, false);
>>  
>>
>> base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
Olek

      reply	other threads:[~2026-10-30 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2026-10-26 21:39   ` Naman Gulati
2026-10-29 16:07     ` Simon Horman
2026-10-30 15:35 ` Alexander Lobakin
2026-10-30 15:36   ` Alexander Lobakin [this message]

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=546ce7e1-32fa-4d7e-a7d4-d6f0d5826afc@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namangulati@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox