lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1447964139.22599.246.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Thu, 19 Nov 2015 12:15:39 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:	David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: remove useless check in napi_gro_frags()

On Thu, 2015-11-19 at 11:54 -0800, Alexei Starovoitov wrote:
> On Thu, Nov 19, 2015 at 11:42:50AM -0800, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com>
> > 
> > Checking if skb is NULL in napi_gro_frags() is too late.
> > 
> > If skb was NULL, we would crash earlier in napi_frags_skb()
> > 
> > Drivers normally catch napi_get_frags() NULL return value
> > before calling napi_gro_frags()
> > 
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > ---
> >  net/core/dev.c |    3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 41cef3e3f558b857a9093a83f6b0c73f32b8b45f..8d8d34ff68f5800dbcb2958b6a937b9db478e359 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -4465,9 +4465,6 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
> >  {
> >  	struct sk_buff *skb = napi_frags_skb(napi);
> >  
> > -	if (!skb)
> > -		return GRO_DROP;
> > -
> 
> I don't get it. napi_frags_skb() can return valid NULL.
> Should it be fixed there as well?
> Must be missing something...


How many times should we crash before napi_frags_skb() returns NULL ?

At least one time, and this is enough really ...


static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
{
        struct sk_buff *skb = napi->skb;
        const struct ethhdr *eth;
        unsigned int hlen = sizeof(*eth);

        napi->skb = NULL;

        skb_reset_mac_header(skb);
        skb_gro_reset_offset(skb);

        eth = skb_gro_header_fast(skb, 0);
        if (unlikely(skb_gro_header_hard(skb, hlen))) {
                eth = skb_gro_header_slow(skb, hlen, 0);
                if (unlikely(!eth)) {
                        napi_reuse_skb(napi, skb);
                        return NULL;
                }
        } else {
                gro_pull_from_frag0(skb, hlen);
                NAPI_GRO_CB(skb)->frag0 += hlen;
                NAPI_GRO_CB(skb)->frag0_len -= hlen;
        }
        __skb_pull(skb, hlen);
        /*
         * This works because the only protocols we care about don't require
         * special handling.
         * We'll fix it up properly in napi_frags_finish()
         */
        skb->protocol = eth->h_proto;

        return skb;
}





--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ