]> git.baikalelectronics.ru Git - kernel.git/commit
net: Fix range checks in tcf_valid_offset().
authorDavid S. Miller <davem@davemloft.net>
Tue, 21 Dec 2010 20:43:16 +0000 (12:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Dec 2010 20:43:16 +0000 (12:43 -0800)
commit112192ad89649cf3e6d0abbae688a1ad3a7579c0
treee3678d5af507054c86f1d913ad1599f4afee1c7d
parent62f171028cfdba2adf56878022ea931ad5eb41fd
net: Fix range checks in tcf_valid_offset().

This function has three bugs:

1) The offset should be valid most of the time, this is just
   a sanity check, therefore we should use "likely" not "unlikely"

2) This is the only place where we can check for arithmetic overflow
   of the pointer plus the length.

3) The existing range checks are off by one, the valid range is
   skb->head to skb_tail_pointer(), inclusive.

Based almost entirely upon a patch by Ralph Loader.

Reported-by: Ralph Loader <suckfish@ihug.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_cls.h