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 6ac29a46e23e188be0c3f246c7ff77e538d04ab1..484f58750eba0438cff11dcf0979ceb4ef46738b 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;