提交 9b8adb5e 编写于 作者: E Eric W. Biederman 提交者: David S. Miller

net: Fix devinet_sysctl_forward

sysctls are unregistered with the rntl_lock held making
it unsafe to unconditionally grab the the rtnl_lock.  Instead
we need to call rtnl_trylock and restart the system call
if we can not grab it.  Otherwise we could deadlock at unregistration
time.
Signed-off-by: NEric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5007392d
...@@ -1347,7 +1347,8 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write, ...@@ -1347,7 +1347,8 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
struct net *net = ctl->extra2; struct net *net = ctl->extra2;
if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) { if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) {
rtnl_lock(); if (!rtnl_trylock())
return restart_syscall();
if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) { if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) {
inet_forward_change(net); inet_forward_change(net);
} else if (*valp) { } else if (*valp) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册