net-sysfs: Use rtnl_trylock in wireless sysfs methods.
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 19 Feb 2010 13:23:47 +0000 (13:23 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Feb 2010 23:40:51 +0000 (15:40 -0800)
The wireless sysfs methods like the rest of the networking sysfs
methods are removed with the rtnl_lock held and block until
the existing methods stop executing.  So use rtnl_trylock
and restart_syscall so that the code continues to work.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net-sysfs.c

index fbc1c7472c5e4cafffb5f1455895907c45ade25e..099c753c4213ae814b51bf4e149eeb4f79836224 100644 (file)
@@ -410,7 +410,8 @@ static ssize_t wireless_show(struct device *d, char *buf,
        const struct iw_statistics *iw;
        ssize_t ret = -EINVAL;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        if (dev_isalive(dev)) {
                iw = get_wireless_stats(dev);
                if (iw)