[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150604.010511.1149657919915294597.davem@davemloft.net>
Date: Thu, 04 Jun 2015 01:05:11 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next] tcp: remove redundant checks
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Wed, 03 Jun 2015 23:49:21 -0700
> From: Eric Dumazet <edumazet@...gle.com>
>
> tcp_v4_rcv() checks the following before calling tcp_v4_do_rcv():
>
> if (th->doff < sizeof(struct tcphdr) / 4)
> goto bad_packet;
> if (!pskb_may_pull(skb, th->doff * 4))
> goto discard_it;
>
> So following check in tcp_v4_do_rcv() is redundant
> and "goto csum_err;" is wrong anyway.
>
> if (skb->len < tcp_hdrlen(skb) || ...)
> goto csum_err;
>
> A second check can be removed after no_tcp_socket label for same reason.
>
> Same tests can be removed in tcp_v6_do_rcv()
>
> Note : short tcp frames are not properly accounted in tcpInErrs MIB,
> because pskb_may_pull() failure simply drops incoming skb, we might
> fix this in a separate patch.
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Looks sane, applied, thanks Eric!
--
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