]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net: Fix bridgeing sysfs handling of rtnl_lock
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 13 May 2009 17:00:41 +0000 (17:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 May 2009 05:15:59 +0000 (22:15 -0700)
Holding rtnl_lock when we are unregistering the sysfs files can
deadlock if we unconditionally take rtnl_lock in a sysfs file.  So fix
it with the now familiar patter of: rtnl_trylock and syscall_restart()

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_sysfs_br.c
net/bridge/br_sysfs_if.c

index 603d89248e7148e1a830146953dfbfdcb54491bd..ee4820aa1843ee5e54c1b677f4cd5875a440d442 100644 (file)
@@ -172,7 +172,8 @@ static ssize_t store_stp_state(struct device *d,
        if (endp == buf)
                return -EINVAL;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        br_stp_set_enabled(br, val);
        rtnl_unlock();
 
index 02b2d50cce4da640f4b62a6652253d217e890af2..4a3cdf8f38131e6b19adf330a0e697a307a39e16 100644 (file)
@@ -189,7 +189,8 @@ static ssize_t brport_store(struct kobject * kobj,
 
        val = simple_strtoul(buf, &endp, 0);
        if (endp != buf) {
-               rtnl_lock();
+               if (!rtnl_trylock())
+                       return restart_syscall();
                if (p->dev && p->br && brport_attr->store) {
                        spin_lock_bh(&p->br->lock);
                        ret = brport_attr->store(p, val);