netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [NET]: fix multicast list when cloning sockets
@ 2007-07-30 16:04 Flavio Leitner
  2007-07-31  2:01 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Flavio Leitner @ 2007-07-30 16:04 UTC (permalink / raw)
  To: David L Stevens; +Cc: davem, acme, netdev


The sock_copy() function uses memcpy() to clone the socket
including the struct ip_mc_socklist *mc_list pointer.

The ip_mc_drop_socket() function is called when socket is closed
to free these objects leaving the other sockets cloned from the
same master socket with invalid pointers.

This patch sets mc_list of cloned socket to NULL.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index fbe7714..8ee0f54 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -506,6 +506,8 @@ struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
 		newicsk->icsk_backoff	  = 0;
 		newicsk->icsk_probes_out  = 0;
 
+		inet_sk(inet)->mc_list = NULL;
+
 		/* Deinitialize accept_queue to trap illegal accesses. */
 		memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue));
 
-- 
1.5.2.4

-- 
Flavio

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

end of thread, other threads:[~2007-08-25  5:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-30 16:04 [PATCH] [NET]: fix multicast list when cloning sockets Flavio Leitner
2007-07-31  2:01 ` David Miller
2007-07-31  3:00   ` Arnaldo Carvalho de Melo
2007-07-31 18:29     ` Flavio Leitner
2007-08-25  5:16       ` David Miller

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).