From: Stefano Brivio <sbrivio@redhat.com>
To: Eric Dumazet <edumazet@google.com>
Cc: David Miller <davem@davemloft.net>,
Jianlin Shi <jishi@redhat.com>,
Hangbin Liu <liuhangbin@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>,
netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net 2/2] neighbour: BUG_ON() writing before skb->head in neigh_hh_output()
Date: Wed, 5 Dec 2018 01:38:49 +0100 [thread overview]
Message-ID: <20181205013849.292614d5@redhat.com> (raw)
In-Reply-To: <CANn89i+VoX7LNq4uGztJvH3EVzbE=Rhab=erkCOzHo3xyWBExg@mail.gmail.com>
On Tue, 4 Dec 2018 16:26:05 -0800
Eric Dumazet <edumazet@google.com> 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
prev parent reply other threads:[~2018-12-05 0:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 0:13 [PATCH net 0/2] Fix slab out-of-bounds on insufficient headroom for IPv6 packets Stefano Brivio
2018-12-05 0:13 ` [PATCH net 1/2] ipv6: Check available headroom in ip6_xmit() even without options Stefano Brivio
2018-12-05 0:13 ` [PATCH net 2/2] neighbour: BUG_ON() writing before skb->head in neigh_hh_output() Stefano Brivio
[not found] ` <CANn89i+VoX7LNq4uGztJvH3EVzbE=Rhab=erkCOzHo3xyWBExg@mail.gmail.com>
2018-12-05 0:38 ` Stefano Brivio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181205013849.292614d5@redhat.com \
--to=sbrivio@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jishi@redhat.com \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).