]> git.baikalelectronics.ru Git - kernel.git/commit
net: drop skb on failure in ip_check_defrag()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 1 Nov 2018 19:02:37 +0000 (12:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Nov 2018 20:55:30 +0000 (13:55 -0700)
commit29bc2affc28dcb75ebb2c45dc638441219ccbc9e
treeb1b64a2bffe25c4c250465e3bcd45d21f1dca1ba
parentbadf832c0505876ed3e0f5f9dd70698b8723eea4
net: drop skb on failure in ip_check_defrag()

Most callers of pskb_trim_rcsum() simply drop the skb when
it fails, however, ip_check_defrag() still continues to pass
the skb up to stack. This is suspicious.

In ip_check_defrag(), after we learn the skb is an IP fragment,
passing the skb to callers makes no sense, because callers expect
fragments are defrag'ed on success. So, dropping the skb when we
can't defrag it is reasonable.

Note, prior to commit e63754b567b2, this is not a big problem as
checksum will be fixed up anyway. After it, the checksum is not
correct on failure.

Found this during code review.

Fixes: e63754b567b2 ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends")
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_fragment.c