Commit cf90340e authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[NETLINK]: Fix mc_list operations

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.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bfc2a7d5
......@@ -471,9 +471,16 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment