]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: take care of truncations done by sk_filter()
authorEric Dumazet <edumazet@google.com>
Thu, 10 Nov 2016 21:12:35 +0000 (13:12 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 13 Nov 2016 17:30:02 +0000 (12:30 -0500)
commited69ed17f955d2428e727b64c44e136e2013890c
treeee4ad258481549b15aa79cccf97b47c5ff3954e1
parent1958b9d8ca5ac096b6f55773db056e6ce7f734cc
tcp: take care of truncations done by sk_filter()

With syzkaller help, Marco Grassi found a bug in TCP stack,
crashing in tcp_collapse()

Root cause is that sk_filter() can truncate the incoming skb,
but TCP stack was not really expecting this to happen.
It probably was expecting a simple DROP or ACCEPT behavior.

We first need to make sure no part of TCP header could be removed.
Then we need to adjust TCP_SKB_CB(skb)->end_seq

Many thanks to syzkaller team and Marco for giving us a reproducer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Marco Grassi <marco.gra@gmail.com>
Reported-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c