Files
linux/net/ipv4
Eric Dumazet 78c4e3d484 tcp: clear saved_syn in tcp_disconnect()
[ Upstream commit 17c3060b17 ]

In the (very unlikely) case a passive socket becomes a listener,
we do not want to duplicate its saved SYN headers.

This would lead to double frees, use after free, and please hackers and
various fuzzers

Tested:
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, IPPROTO_TCP, TCP_SAVE_SYN, [1], 4) = 0
   +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0

   +0 bind(3, ..., ...) = 0
   +0 listen(3, 5) = 0

   +0 < S 0:0(0) win 32972 <mss 1460,nop,wscale 7>
   +0 > S. 0:0(0) ack 1 <...>
  +.1 < . 1:1(0) ack 1 win 257
   +0 accept(3, ..., ...) = 4

   +0 connect(4, AF_UNSPEC, ...) = 0
   +0 close(3) = 0
   +0 bind(4, ..., ...) = 0
   +0 listen(4, 5) = 0

   +0 < S 0:0(0) win 32972 <mss 1460,nop,wscale 7>
   +0 > S. 0:0(0) ack 1 <...>
  +.1 < . 1:1(0) ack 1 win 257

Fixes: cd8ae85299 ("tcp: provide SYN headers for passive connections")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-02 21:19:53 -07:00
..
2016-11-15 07:46:38 +01:00
2015-08-25 13:38:50 -07:00
2016-11-15 07:46:38 +01:00
2016-11-15 07:46:38 +01:00
2015-11-02 22:47:14 -05:00
2017-02-26 11:07:50 +01:00
2015-10-21 07:00:48 -07:00
2017-04-30 05:49:29 +02:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2017-03-22 12:04:17 +01:00
2014-09-01 18:12:45 -07:00
2015-10-21 07:00:53 -07:00
2015-07-09 14:22:52 -07:00
2015-07-09 14:22:52 -07:00
2017-05-02 21:19:53 -07:00
2016-11-15 07:46:38 +01:00
2016-11-15 07:46:39 +01:00
2015-09-17 17:18:37 -07:00