From: Jakub Kicinski <kuba@kernel.org>
To: justinlai0215@realtek.com
Cc: Yun Lu <luyun_611@163.com>,
larry.chiu@realtek.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
netdev@vger.kernel.org
Subject: Re: [PATCH] rtase: fix double free of multi-frag skb on DMA map failure
Date: Thu, 23 Jul 2026 10:25:07 -0700 [thread overview]
Message-ID: <20260723102507.35b4246b@kernel.org> (raw)
In-Reply-To: <20260721023836.6691-1-luyun_611@163.com>
On Tue, 21 Jul 2026 10:38:36 +0800 Yun Lu wrote:
> From: Yun Lu <luyun@kylinos.cn>
>
> In rtase_start_xmit(), when the head buffer DMA mapping fails after
> rtase_xmit_frags() has mapped all fragments, the error path clears
> the fragment descriptors with rtase_tx_clear_range(), which frees
> the skb through the last-frag slot and accounts tx_dropped. Control
> then falls through to the common error label, which frees the same
> skb a second time and counts it again.
>
> Return right after clearing the fragments when the skb owns frags;
> the no-frag case still drops through and frees the head skb once.
>
> Fixes: d6e882b89fdf ("rtase: Implement .ndo_start_xmit function")
> Signed-off-by: Yun Lu <luyun@kylinos.cn>
Justin, please review.
> diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> index 255667775f0e..67f7fdada119 100644
> --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> @@ -1426,6 +1426,9 @@ static netdev_tx_t rtase_start_xmit(struct sk_buff *skb,
> err_dma_1:
> ring->skbuff[entry] = NULL;
> rtase_tx_clear_range(ring, ring->cur_idx + 1, frags);
> + if (frags)
> + /* the frags were cleared above, along with the skb */
> + return NETDEV_TX_OK;
>
> err_dma_0:
> tp->stats.tx_dropped++;
prev parent reply other threads:[~2026-07-23 17:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 2:38 [PATCH] rtase: fix double free of multi-frag skb on DMA map failure Yun Lu
2026-07-22 19:55 ` Jacob Keller
2026-07-23 17:25 ` Jakub Kicinski [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=20260723102507.35b4246b@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=justinlai0215@realtek.com \
--cc=larry.chiu@realtek.com \
--cc=luyun_611@163.com \
--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