Re: [PATCH net] vlan: require the MAC header to be present in __vlan_insert_inner_tag()
From: Jakub Kicinski
Date: Sat Sep 19 2026 - 18:49:19 EST
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. 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..