Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166315
b: refs/heads/master
c: b827357
h: refs/heads/master
i:
  166313: aa4dbba
  166311: 96b45b8
v: v3
  • Loading branch information
Johannes Berg authored and David S. Miller committed Sep 24, 2009
1 parent 52b4357 commit 90b61a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 704cc92e9ffe29458ea8831ae097c631b1160c01
refs/heads/master: b8273570f802a7658827dcb077b0b517ba75a289
1 change: 1 addition & 0 deletions trunk/include/linux/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ extern struct sock *netlink_kernel_create(struct net *net,
extern void netlink_kernel_release(struct sock *sk);
extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
extern int netlink_has_listeners(struct sock *sk, unsigned int group);
Expand Down
19 changes: 11 additions & 8 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,16 @@ int netlink_change_ngroups(struct sock *sk, unsigned int groups)
return err;
}

void __netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
{
struct sock *sk;
struct hlist_node *node;
struct netlink_table *tbl = &nl_table[ksk->sk_protocol];

sk_for_each_bound(sk, node, &tbl->mc_list)
netlink_update_socket_mc(nlk_sk(sk), group, 0);
}

/**
* netlink_clear_multicast_users - kick off multicast listeners
*
Expand All @@ -1619,15 +1629,8 @@ int netlink_change_ngroups(struct sock *sk, unsigned int groups)
*/
void netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
{
struct sock *sk;
struct hlist_node *node;
struct netlink_table *tbl = &nl_table[ksk->sk_protocol];

netlink_table_grab();

sk_for_each_bound(sk, node, &tbl->mc_list)
netlink_update_socket_mc(nlk_sk(sk), group, 0);

__netlink_clear_multicast_users(ksk, group);
netlink_table_ungrab();
}

Expand Down
4 changes: 3 additions & 1 deletion trunk/net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ static void __genl_unregister_mc_group(struct genl_family *family,
struct net *net;
BUG_ON(grp->family != family);

netlink_table_grab();
rcu_read_lock();
for_each_net_rcu(net)
netlink_clear_multicast_users(net->genl_sock, grp->id);
__netlink_clear_multicast_users(net->genl_sock, grp->id);
rcu_read_unlock();
netlink_table_ungrab();

clear_bit(grp->id, mc_groups);
list_del(&grp->list);
Expand Down

0 comments on commit 90b61a4

Please sign in to comment.