Re: [PATCH net] vlan: require the MAC header to be present in __vlan_insert_inner_tag()

From: Simon Horman

Date: Sun Sep 20 2026 - 05:27:52 EST


On Sat, Sep 19, 2026 at 03:49:11PM -0700, Jakub Kicinski wrote:
> On Sat, 19 Sep 2026 08:45:35 +0100 Simon Horman wrote:
> > > + if (unlikely(!pskb_may_pull(skb, mac_len)))
> > > + return -EINVAL;
> > > +
> > > if (skb_cow_head(skb, meta_len + VLAN_HLEN) < 0)
> > > return -ENOMEM;
> >
> > TBH I am surprised that we have a bug like this in this function.
> > But your analysis matches my understanding of the code.
>
> FWIW I suspect it's because non-ethernet packets shouldn't normally
> reach ethernet helpers.

Yes, I agree that seems likely.

> But I'm not sure how practical it would be
> to push mac_len checks to the callers or anything of the sort,
> so we can as well check here..