[NETLINK] Fix bogus mc_list deletion

Linux Kernel Mailing List <[email protected]> Tue, 29 Mar 2005 14:36:18 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1489, 2005/03/29 11:36:18-03:00, [email protected]

	[NETLINK] Fix bogus mc_list deletion
	
	
	On Tue, Mar 29, 2005 at 08:11:45PM +0900, Tim Burress wrote:
	>
	> So not only is the socket dead, it's not even a Netlink socket.
	> Apparently a socket originally allocated to Netlink was not unlinked
	> from the mc_list after it was freed, but offhand I can't see how that
	> could happen.
	
	Thanks for tracking this issue down.
	
	Looks like I made a nasty typo in the 2.4 backport.  When entries
	are unlinked from mc_list, we link the list up with the regular
	hash bucket list by using next instead of bind_next!
	
	Signed-off-by: Herbert Xu <[email protected]>
	
	===== net/netlink/af_netlink.c 1.21 vs edited =====



 af_netlink.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c	2005-03-29 12:02:22 -08:00
+++ b/net/netlink/af_netlink.c	2005-03-29 12:02:22 -08:00
@@ -340,9 +340,9 @@
 	}
 	if (!nlk_sk(sk)->groups)
 		goto out;
-	for (skp = &table->mc_list; *skp; skp = &((*skp)->next)) {
+	for (skp = &table->mc_list; *skp; skp = &((*skp)->bind_next)) {
 		if (*skp == sk) {
-			*skp = sk->next;
+			*skp = sk->bind_next;
 			break;
 		}
 	}