mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
9b8adb5ea0
commit
af38f29895
2 changed files with 4 additions and 2 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue