lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <469CE541.9090708@trash.net>
Date:	Tue, 17 Jul 2007 17:50:25 +0200
From:	Patrick McHardy <kaber@...sh.net>
To:	Johannes Berg <johannes@...solutions.net>
CC:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
	Zhang Rui <rui.zhang@...el.com>, jamal <hadi@...erus.ca>
Subject: Re: [patch 2/3] netlink: allow removing multicast groups

Johannes Berg wrote:
> +static void netlink_update_socket_mc(struct netlink_sock *nlk,
> +				     unsigned int group,
> +				     int is_new)
> +{
> +	int old, new = !!is_new, subscriptions;
> +
> +	netlink_table_grab();


Having the caller lock the table would save lots of atomic operation
in case of netlink_clear_multicast_users.

> +	old = test_bit(group - 1, nlk->groups);
> +	subscriptions = nlk->subscriptions - old + new;
> +	if (new)
> +		__set_bit(group - 1, nlk->groups);
> +	else
> +		__clear_bit(group - 1, nlk->groups);
> +	netlink_update_subscriptions(&nlk->sk, subscriptions);
> +	netlink_update_listeners(&nlk->sk);
> +	netlink_table_ungrab();
> +}
> +

> +void netlink_clear_multicast_users(int unit, unsigned int group)

Same as in the last patch, passing the kernel socket would be nicer IMO.

> +{
> +	struct sock *sk;
> +	struct hlist_node *node;
> +
> +	read_lock(&nl_table_lock);

Won't this deadlock? netlink_table_grab takes a write-lock.

> +
> +	sk_for_each_bound(sk, node, &nl_table[unit].mc_list)
> +		netlink_update_socket_mc(nlk_sk(sk), group, 0);
> +
> +	read_unlock(&nl_table_lock);
> +}
> +EXPORT_SYMBOL(netlink_clear_multicast_users);
> +
>  void netlink_set_nonroot(int protocol, unsigned int flags)
>  {
>  	if ((unsigned int)protocol < MAX_LINKS)
> 

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ