Eric Dumazet
479beb4c65
tcp: clear saved_syn in tcp_disconnect()
...
[ Upstream commit 17c3060b1701fc69daedb4c90be6325d3d9fca8e ]
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: cd8ae85299d5 ("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-03 08:36:35 -07:00
..
2016-09-19 20:19:34 +02:00
2016-09-23 13:47:44 -04:00
2016-10-20 14:32:22 -04:00
2016-09-10 21:19:10 -07:00
2016-09-10 21:19:10 -07:00
2017-02-04 09:47:09 +01:00
2016-12-02 10:46:59 +01:00
2016-11-22 22:50:46 +01:00
2017-03-22 12:43:34 +01:00
2016-12-05 14:48:48 -05:00
2017-02-18 15:11:40 +01:00
2017-04-08 09:30:30 +02:00
2017-05-03 08:36:34 -07:00
2016-12-03 23:54:25 -05:00
2017-03-22 12:43:35 +01:00
2016-07-05 14:08:47 -07:00
2017-02-18 15:11:43 +01:00
2017-02-18 15:11:43 +01:00
2016-10-18 10:28:18 -04:00
2016-07-08 13:23:12 +02:00
2017-05-03 08:36:35 -07:00
2017-04-21 09:31:24 +02:00
2017-02-26 11:10:51 +01:00
2017-01-19 20:18:04 +01:00
2017-05-03 08:36:34 -07:00
2017-05-03 08:36:35 -07:00
2016-09-10 23:12:53 -07:00
2017-02-26 11:10:50 +01:00
2017-04-27 09:10:38 +02:00
2016-09-19 20:19:34 +02:00
2017-03-22 12:43:34 +01:00
2016-10-20 11:23:08 -04:00
2017-03-12 06:41:53 +01:00
2016-06-27 15:06:18 -04:00
2016-12-05 19:43:42 -05:00
2016-07-11 02:02:03 +02:00
2017-03-30 09:41:21 +02:00
2017-05-03 08:36:35 -07:00
2016-12-02 13:29:26 -05:00
2016-07-13 11:53:40 -07:00
2016-10-13 08:43:17 +01:00
2017-03-22 12:43:34 +01:00
2017-05-03 08:36:35 -07:00
2017-03-22 12:43:33 +01:00
2017-04-12 12:41:17 +02:00
2016-10-19 10:58:04 -04:00
2016-12-02 14:03:20 -05:00
2017-03-30 09:41:21 +02:00
2017-01-09 08:32:23 +01:00
2017-04-12 12:41:11 +02:00
2016-09-09 18:13:30 -07:00
2017-03-31 10:31:45 +02:00
2016-06-09 23:41:03 -07:00
2016-08-17 19:36:23 -04:00
2016-08-17 19:36:23 -04:00
2017-02-26 11:10:51 +01:00
2016-10-06 09:52:23 -07:00