Skip to content

Commit

Permalink
net: Avoid race between network down and sysfs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Mar 3, 2009
1 parent 07555c9 commit 5a5990d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5a5990d

Please sign in to comment.