tcp: fix various issues for sockets morphing to listen state
authorEric Dumazet <edumazet@google.com>
Fri, 3 Mar 2017 22:08:21 +0000 (14:08 -0800)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:30 +0000 (14:04 +0200)
commit9b4c2e72f845a640a8dea56b8feebcf426df140b
tree32b673c88190c2325a6310bae0e5ea61a700ec31
parent0363343e50f8aad7462cd0f2017d9eb4ae402138
tcp: fix various issues for sockets morphing to listen state

commit 02b2faaf0af1d85585f6d6980e286d53612acfc2 upstream.

Dmitry Vyukov reported a divide by 0 triggered by syzkaller, exploiting
tcp_disconnect() path that was never really considered and/or used
before syzkaller ;)

I was not able to reproduce the bug, but it seems issues here are the
three possible actions that assumed they would never trigger on a
listener.

1) tcp_write_timer_handler
2) tcp_delack_timer_handler
3) MTU reduction

Only IPv6 MTU reduction was properly testing TCP_CLOSE and TCP_LISTEN
 states from tcp_v6_mtu_reduced()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_timer.c