diff options
| author | Eric Dumazet <edumazet@google.com> | 2017-03-04 01:08:21 +0300 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-03-08 00:58:33 +0300 | 
| commit | 02b2faaf0af1d85585f6d6980e286d53612acfc2 (patch) | |
| tree | 1d5684fc4dd1f82e2fa7883e8f291674a2d3d8b7 /net/ipv4/tcp_ipv4.c | |
| parent | b73d2da8c724bb26885512e1ba47b91e2a9f48c3 (diff) | |
| download | linux-02b2faaf0af1d85585f6d6980e286d53612acfc2.tar.xz | |
tcp: fix various issues for sockets morphing to listen state
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>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 9a89b8deafae..8f3ec1365497 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -279,10 +279,13 @@ EXPORT_SYMBOL(tcp_v4_connect);   */  void tcp_v4_mtu_reduced(struct sock *sk)  { -	struct dst_entry *dst;  	struct inet_sock *inet = inet_sk(sk); -	u32 mtu = tcp_sk(sk)->mtu_info; +	struct dst_entry *dst; +	u32 mtu; +	if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) +		return; +	mtu = tcp_sk(sk)->mtu_info;  	dst = inet_csk_update_pmtu(sk, mtu);  	if (!dst)  		return;  | 
