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:
parent
07555c9880
commit
5a5990d309
1 changed files with 3 additions and 1 deletions
|
@ -77,7 +77,9 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
|
||||||
if (endp == buf)
|
if (endp == buf)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
rtnl_lock();
|
if (!rtnl_trylock())
|
||||||
|
return -ERESTARTSYS;
|
||||||
|
|
||||||
if (dev_isalive(net)) {
|
if (dev_isalive(net)) {
|
||||||
if ((ret = (*set)(net, new)) == 0)
|
if ((ret = (*set)(net, new)) == 0)
|
||||||
ret = len;
|
ret = len;
|
||||||
|
|
Loading…
Reference in a new issue