Re: [PATCH] genetlink: free the skb on 'group >= family->n_mcgrps'

From: Alice Ryhl

Date: Mon May 04 2026 - 06:45:53 EST


On Mon, May 04, 2026 at 03:20:25AM -0700, Eric Dumazet wrote:
> On Mon, May 4, 2026 at 2:17 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> >
> > These methods generally consume ownership of the provided skb, so even
> > if an error path is encountered, the skb is freed. This is because the
> > very first thing they do after some initial setup is to unconditionally
> > consume the skb via consume_skb(skb). Any subsequent errors lead to the
> > core netlink layer freeing the skb.
> >
> > However, there is one check that occurs before ownership is passed,
> > which is the check for the group index. So if this error condition is
> > encountered, then the skb is leaked. This error condition is generally
> > considered a violation of the netlink API, so it's not expected to occur
> > under normal circumstances. For the same reason, no callers check for
> > this error condition, and no callers need to be adjusted. However, we
> > should still follow the same ownership semantics of the rest of the
> > function. Thus, free the skb in this codepath.
> >
> > Assisted-by: Antigravity:gemini
> > Suggested-by: Andrew Lunn <andrew@xxxxxxx>
> > Suggested-by: Matthew Maurer <mmaurer@xxxxxxxxxx>
> > Link: https://lore.kernel.org/r/845b36ba-7b3a-41f2-acb2-b284f253e2ca@xxxxxxx
> > Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
> 1) This looks like a fix meant for net tree ?
>
> 2) We require a Fixes: tag for bug fixes.
>
> For more details I highly recommend reading at least the tl;dr part of:
>
> Documentation/process/maintainer-netdev.rst

Sorry I forgot that the net subsystem has special rules.

I do not believe any callers actually excercise this codepath, but I
will add a Fixes: tag and indicate 'net' tree for the next version in a
few days.

Alice