Subject: Re: [PATCH net 2/2] neighbour: BUG_ON() writing before skb->head in neigh_hh_output()

From: Stefano Brivio <[email-masked]>
Date: Wed, 5 Dec 2018 01:38:49 +0100

On Tue, 4 Dec 2018 16:26:05 -0800
Eric Dumazet <[email-masked]> wrote:

> > +       /* skb_push() won't panic if we have room for the unaligned size
> > only */
> > +       BUG_ON(skb_headroom(skb) < hh_alen);
> >  
> 
> What about avoiding the panic and instead call kfree_skb() ?
> 
>          if (WARN_ON_ONCE(skb_headroom(skb) < hh_alen)) {
>               kfree_skb(skb);
>              return NET_XMIT_DROP;
>         }

Okay, I guess it won't go unnoticed anyway, and it's probably better
than the alternative.

> > +
> >         skb_push(skb, hh_len);
> >  
> 
> Maybe we can use __skb_push() here, since prior safety check should be
> enough ?

Indeed, I'll change that in v2. Thanks!

-- 
Stefano