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] [day] [month] [year] [list]
Message-ID: <20100527150202.GC6916@psychotron.lab.eng.brq.redhat.com>
Date:	Thu, 27 May 2010 17:02:04 +0200
From:	Jiri Pirko <jpirko@...hat.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net, shemminger@...tta.com,
	kaber@...sh.net
Subject: Re: [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb

Thu, May 27, 2010 at 04:17:46PM CEST, eric.dumazet@...il.com wrote:
>Le jeudi 27 mai 2010 à 15:49 +0200, Jiri Pirko a écrit :
>
>> +/**
>> + *	netdev_rx_handler_unregister - unregister receive handler
>> + *	@dev: device to unregister a handler from
>> + *	@rh: receive handler to unregister
>> + *
>> + *	Unregister a receive hander from a device.
>> + */
>> +void netdev_rx_handler_unregister(struct net_device *dev,
>> +				  struct netdev_rx_handler *rh)
>> +{
>> +	struct netdev_rx_handler *rh1;
>> +
>> +	spin_lock_bh(&dev->rx_handlers_lock);
>> +	list_for_each_entry(rh1, &dev->rx_handlers, list) {
>> +		if (rx_handlers_equal(rh, rh1)) {
>> +			list_del_rcu(&rh1->list);
>> +			synchronize_net();
>> +			kfree(rh1);
>> +			break;
>> +		}
>> +	}
>> +	spin_unlock_bh(&dev->rx_handlers_lock);
>> +}
>> +EXPORT_SYMBOL(netdev_rx_handler_unregister);
>> +
>
>Please dont synchronize_net(); inside the spin_lock_bh() section, at a
>very minimum.
>
>void netdev_rx_handler_unregister(struct net_device *dev,
>                                 struct netdev_rx_handler *rh)
>{
>        struct netdev_rx_handler *rh1, *found = NULL;
>
>       spin_lock_bh(&dev->rx_handlers_lock);
>       list_for_each_entry(rh1, &dev->rx_handlers, list) {
>               if (rx_handlers_equal(rh, rh1)) {
>               		list_del_rcu(&rh1->list);
>			found = rh1;
>               		break;
>               }
>	}
>	spin_unlock_bh(&dev->rx_handlers_lock);
>	if (found) {
>		synchronize_net();
>		kfree(rh1);
>	}
>}

I had it done in the same way originally. But I though that's not a problem to
do in inside the lock.

>
>
>This synchronize_net() proliferation makes me very nervous.
>
>Am I the only one that think this thing is/should be avoided as much as
>possible ?
>
>Please dont use synchronize_net() but a call_rcu(), there is absolutely
>no point making this thread waits 30 or 40 ms, there is no risk here.

Ok, will do. Thanks a lot.
>
>Thanks
>
>
--
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