netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NETLINK] Fix mc_list operations
@ 2004-11-11  4:21 Herbert Xu
  2004-11-15 23:08 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2004-11-11  4:21 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

Hi Dave:

While doing the 2.4 version of the netlink patch, I noticed a bug
in my mc_list code.  First of all it wasn't holding the table lock
when adding nodes to the list.  It also didn't take the node off
the list when multicast is switched off.

The following patch fixes it for 2.6.  I will simply fix it in the
2.4 version.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 613 bytes --]

===== net/netlink/af_netlink.c 1.61 vs edited =====
--- 1.61/net/netlink/af_netlink.c	2004-11-06 18:49:54 +11:00
+++ edited/net/netlink/af_netlink.c	2004-11-11 15:09:40 +11:00
@@ -471,9 +471,16 @@
 			return err;
 	}
 
-	nlk->groups = nladdr->nl_groups;
-	if (nladdr->nl_groups)
+	if (!nladdr->nl_groups && !nlk->groups)
+		return 0;
+
+	netlink_table_grab();
+	if (nlk->groups && !nladdr->nl_groups)
+		__sk_del_bind_node(sk);
+	else if (!nlk->groups && nladdr->nl_groups)
 		sk_add_bind_node(sk, &nl_table[sk->sk_protocol].mc_list);
+	nlk->groups = nladdr->nl_groups;
+	netlink_table_ungrab();
 
 	return 0;
 }

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

* Re: [NETLINK] Fix mc_list operations
  2004-11-11  4:21 [NETLINK] Fix mc_list operations Herbert Xu
@ 2004-11-15 23:08 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2004-11-15 23:08 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

On Thu, 11 Nov 2004 15:21:36 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> While doing the 2.4 version of the netlink patch, I noticed a bug
> in my mc_list code.  First of all it wasn't holding the table lock
> when adding nodes to the list.  It also didn't take the node off
> the list when multicast is switched off.

Applied, thanks Herbert.

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

end of thread, other threads:[~2004-11-15 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-11  4:21 [NETLINK] Fix mc_list operations Herbert Xu
2004-11-15 23:08 ` David S. 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).