From: Jakub Kicinski <kuba@kernel.org>
To: Linus Walleij <linusw@kernel.org>
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, marex@denx.de,
horms@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org,
devicetree@vger.kernel.org, nb@tipi-net.de
Subject: Re: [PATCH net-next v6 3/5] net: dsa: tag_ks8995: Add the KS8995 tag handling
Date: Sat, 13 Jun 2026 13:38:39 -0700 [thread overview]
Message-ID: <20260613133839.6877ed3e@kernel.org> (raw)
In-Reply-To: <CAD++jLnuBv97nUW-EdZXiLmgsUSiVLgkB0R=gKB0zYtr8JN7xg@mail.gmail.com>
On Sat, 13 Jun 2026 18:56:03 +0200 Linus Walleij wrote:
> Which is what I do.
>
> So yeah. skb_free() will be free:ed twice. The code in tag_8021q.c will
> also do that. But what do you expect ->xmit() to return on error if
> not NULL?
>
> When user.c does this:
>
> /* Transmit function may have to reallocate the original SKB,
> * in which case it must have freed it. Only free it here on error.
> */
> nskb = p->xmit(skb, dev);
> if (!nskb) {
> kfree_skb(skb);
> return NETDEV_TX_OK;
> }
>
> return dsa_enqueue_skb(nskb, dev);
>
> The only way to get clean out of this branch if you run
> into an error in ->xmit() is to return NULL!
Yes, maybe DSA experts remember the background here, and can guide us
But from a fresh look this and ->rcv have very odd semantics.
nskb = func(skb);
should assume skb is either freed or returned. Freeing the input param
on failure of func() is a rather strange pattern.
I vote we drop these kfree_skb()s (both xmit and rcv) and fix up any
driver that depended on them (if any)?
next prev parent reply other threads:[~2026-06-13 20:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 22:41 [PATCH net-next v6 0/5] net: dsa: microchip: Add support for KSZ8995XA/KS8995XA Linus Walleij
2026-06-07 22:41 ` [PATCH net-next v6 1/5] net: dsa: microchip: Add fallback Micrel compatibles Linus Walleij
2026-06-07 22:41 ` [PATCH net-next v6 2/5] dt-bindings: net: dsa: microchip: Add KSZ8995XA Linus Walleij
2026-06-07 22:41 ` [PATCH net-next v6 3/5] net: dsa: tag_ks8995: Add the KS8995 tag handling Linus Walleij
2026-06-10 15:39 ` Jakub Kicinski
2026-06-13 16:56 ` Linus Walleij
2026-06-13 20:38 ` Jakub Kicinski [this message]
2026-06-07 22:41 ` [PATCH net-next v6 4/5] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA Linus Walleij
2026-06-10 15:39 ` Jakub Kicinski
2026-06-07 22:41 ` [PATCH net-next v6 5/5] net: dsa: ks8995: Delete surplus driver Linus Walleij
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=20260613133839.6877ed3e@kernel.org \
--to=kuba@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marex@denx.de \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=woojung.huh@microchip.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