Re: [syzbot] [net?] WARNING in mpls_gso_segment

From: Florian Westphal
Date: Thu Feb 22 2024 - 07:57:52 EST


Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> I was thinking about adding a debug check in skb_inner_network_header(skb)
> if inner_network_header is zero (that would mean it is not 'set' yet),
> but this would trigger even after your patch.

What about adding:

static inline bool skb_inner_network_header_was_set(const struct sk_buff *skb)
{
return skb->inner_network_header > 0;
}

.. and using that instead of checking for negative header length
post-subtraction?