aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2009-05-13 13:00:41 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-19 01:15:59 -0400
commitaf38f2989572704a846a5577b5ab3b1e2885cbfb (patch)
treed706c0e977992c360f484399886abd0e0c33de58
parent9b8adb5ea005fe73acd5dd58f9bd47eafa74c9d1 (diff)
net: Fix bridgeing sysfs handling of rtnl_lock
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>
-rw-r--r--net/bridge/br_sysfs_br.c3
-rw-r--r--net/bridge/br_sysfs_if.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 603d89248e71..ee4820aa1843 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -172,7 +172,8 @@ static ssize_t store_stp_state(struct device *d,
172 if (endp == buf) 172 if (endp == buf)
173 return -EINVAL; 173 return -EINVAL;
174 174
175 rtnl_lock(); 175 if (!rtnl_trylock())
176 return restart_syscall();
176 br_stp_set_enabled(br, val); 177 br_stp_set_enabled(br, val);
177 rtnl_unlock(); 178 rtnl_unlock();
178 179
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index 02b2d50cce4d..4a3cdf8f3813 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -189,7 +189,8 @@ static ssize_t brport_store(struct kobject * kobj,
189 189
190 val = simple_strtoul(buf, &endp, 0); 190 val = simple_strtoul(buf, &endp, 0);
191 if (endp != buf) { 191 if (endp != buf) {
192 rtnl_lock(); 192 if (!rtnl_trylock())
193 return restart_syscall();
193 if (p->dev && p->br && brport_attr->store) { 194 if (p->dev && p->br && brport_attr->store) {
194 spin_lock_bh(&p->br->lock); 195 spin_lock_bh(&p->br->lock);
195 ret = brport_attr->store(p, val); 196 ret = brport_attr->store(p, val);