net: Avoid race between network down and sysfs

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stephen Hemminger 2009-02-26 06:49:24 +00:00 committed by David S. Miller
parent 07555c9880
commit 5a5990d309

View file

@ -77,7 +77,9 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
if (endp == buf)
goto err;
rtnl_lock();
if (!rtnl_trylock())
return -ERESTARTSYS;
if (dev_isalive(net)) {
if ((ret = (*set)(net, new)) == 0)
ret = len;