net: Avoid race between network down and sysfs
authorStephen Hemminger <shemminger@vyatta.com>
Thu, 26 Feb 2009 06:49:24 +0000 (06:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Mar 2009 08:47:46 +0000 (00:47 -0800)
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>
net/core/net-sysfs.c

index 6ac29a4..484f587 100644 (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;