netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: do not inherit mc_list from parent
@ 2017-05-09 12:17 Eric Dumazet
  2017-05-09 13:23 ` Eric Dumazet
  2017-05-09 13:29 ` [PATCH v2 net] dccp/tcp: " Eric Dumazet
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Dumazet @ 2017-05-09 12:17 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Pray3r, Andrey Konovalov

From: Eric Dumazet <edumazet@google.com>

syzkaller found a way to trigger double frees from ip_mc_drop_socket()

It turns out that leave a copy of parent mc_list at accept() time,
which is very bad.

Very similar to commit 8b485ce69876 ("tcp: do not inherit
fastopen_req from parent")

Initial report from Pray3r, completed by Andrey one.
Thanks a lot to them !

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Pray3r <pray3r.z@gmail.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
---
Notes:
 - day-0 bug.
 - Not sure if it makes sense for TCP socket to be able to join MC
group ?

 net/ipv4/tcp_minisocks.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 717be4de53248352c758b50557987d898340dd4f..03035e2857fc8b6e4cd8af6e46e81048d4de9105 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -448,6 +448,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
 		minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U);
 		newicsk->icsk_rto = TCP_TIMEOUT_INIT;
 		newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
+		newicsk->icsk_inet.mc_list = NULL;
 
 		newtp->packets_out = 0;
 		newtp->retrans_out = 0;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-09 22:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-09 12:17 [PATCH net] tcp: do not inherit mc_list from parent Eric Dumazet
2017-05-09 13:23 ` Eric Dumazet
2017-05-09 13:30   ` David Miller
2017-05-09 13:29 ` [PATCH v2 net] dccp/tcp: " Eric Dumazet
2017-05-09 19:18   ` David Miller
2017-05-09 22:37   ` Cong Wang
2017-05-09 22:51     ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).