]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/core/net-sysfs.c
net-sysfs: Use rtnl_trylock in sysfs methods.
[karo-tx-linux.git] / net / core / net-sysfs.c
index 2da59a0ac4ac4a527f3db356893b614ed0a0a585..b9641e816eee8f8b8681eb1f7242da425374e9d7 100644 (file)
@@ -78,7 +78,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
                goto err;
 
        if (!rtnl_trylock())
-               return -ERESTARTSYS;
+               return restart_syscall();
 
        if (dev_isalive(net)) {
                if ((ret = (*set)(net, new)) == 0)
@@ -225,7 +225,8 @@ static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr,
        if (len >  0 && buf[len - 1] == '\n')
                --count;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        ret = dev_set_alias(netdev, buf, count);
        rtnl_unlock();
 
@@ -238,7 +239,8 @@ static ssize_t show_ifalias(struct device *dev,
        const struct net_device *netdev = to_net_dev(dev);
        ssize_t ret = 0;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        if (netdev->ifalias)
                ret = sprintf(buf, "%s\n", netdev->ifalias);
        rtnl_unlock();