Netdev List
 help / color / mirror / Atom feed
From: Qingfang Deng <qingfang.deng@linux.dev>
To: Linus Walleij <linusw@kernel.org>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Jonas Gorski" <jonas.gorski@gmail.com>,
	"Hauke Mehrtens" <hauke@hauke-m.de>,
	"Kurt Kanzenbach" <kurt@linutronix.de>,
	"Woojung Huh" <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com,
	"Chester A. Unal" <chester.a.unal@arinc9.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Wei Fang" <wei.fang@nxp.com>,
	"Clark Wang" <xiaoning.wang@nxp.com>,
	"Clément Léger" <clement.leger@bootlin.com>,
	"George McCollister" <george.mccollister@gmail.com>,
	"David Yang" <mmyangfl@gmail.com>,
	netdev@vger.kernel.org,
	"Sashiko AI Review" <sashiko-bot@kernel.org>
Subject: Re: [PATCH net] net: dsa: Fix skb ownership in taggers
Date: Tue, 16 Jun 2026 10:20:43 +0800	[thread overview]
Message-ID: <20260616022043.684-1-qingfang.deng@linux.dev> (raw)
In-Reply-To: <20260616-dsa-fix-free-skb-v1-1-fd30b35dcf66@kernel.org>

On 16 Jun 2026 at 00:33:00 +0200, Linus Walleij wrote:
> diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
> index cf9420439054..23f032b76190 100644
> --- a/net/dsa/tag_brcm.c
> +++ b/net/dsa/tag_brcm.c
> @@ -102,10 +102,12 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
>  	 * (including FCS and tag) because the length verification is done after
>  	 * the Broadcom tag is stripped off the ingress packet.
>  	 *
> -	 * Let dsa_user_xmit() free the SKB
> +	 * Free the SKB on error.
>  	 */
> -	if (__skb_put_padto(skb, ETH_ZLEN + BRCM_TAG_LEN, false))
> +	if (__skb_put_padto(skb, ETH_ZLEN + BRCM_TAG_LEN, false)) {
> +		kfree_skb(skb);

There are multiple __skb_put_padto() calls in this patch, which can be
simplified to:

	if (skb_put_padto(skb, minlength))
		return NULL;

skb_put_padto() frees the skb on error.

Regards,
Qingfang

      parent reply	other threads:[~2026-06-16  2:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 22:33 [PATCH net] net: dsa: Fix skb ownership in taggers Linus Walleij
2026-06-16  1:01 ` Jakub Kicinski
2026-06-16  1:52 ` Wei Fang
2026-06-16  2:20 ` Qingfang Deng [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=20260616022043.684-1-qingfang.deng@linux.dev \
    --to=qingfang.deng@linux.dev \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chester.a.unal@arinc9.com \
    --cc=clement.leger@bootlin.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=george.mccollister@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=horms@kernel.org \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linusw@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mmyangfl@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=wei.fang@nxp.com \
    --cc=woojung.huh@microchip.com \
    --cc=xiaoning.wang@nxp.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