Subject: FIX (was Re: Demonstration code on how to trigger tcp6_sock leak)

From: "David S. Miller" <[email-masked]>
Date: Mon, 26 Jan 2004 12:30:42 -0800 (PST)

Ok, I've figured out the bug.  Arnaldo only fixed one of the
two incorrect calls to sk_add_node() which should both be
__sk_add_node().

Erik give this a spin.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1520  -> 1.1521 
#	 net/ipv6/tcp_ipv6.c	1.76    -> 1.77   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/26	[email-masked]	1.1521
# [IPV6]: Fix TCP socket leak, do not grab socket reference when adding to main hashes.
# --------------------------------------------
#
diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c	Mon Jan 26 12:34:20 2004
+++ b/net/ipv6/tcp_ipv6.c	Mon Jan 26 12:34:20 2004
@@ -485,7 +485,7 @@
 
 unique:
 	BUG_TRAP(sk_unhashed(sk));
-	sk_add_node(sk, &head->chain);
+	__sk_add_node(sk, &head->chain);
 	sk->sk_hashent = hash;
 	sock_prot_inc_use(sk->sk_prot);
 	write_unlock_bh(&head->lock);