netfilter: ctnetlink: fix scheduling while atomic

Caused by call to request_module() while holding nf_conntrack_lock.

Reported-and-tested-by: Kövesdi György <kgy@teledigit.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Patrick McHardy 2009-01-21 12:19:49 -08:00 committed by David S. Miller
parent 37fe4732b9
commit 748085fcbe

View file

@ -831,13 +831,16 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
if (!parse_nat_setup) { if (!parse_nat_setup) {
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
rcu_read_unlock(); rcu_read_unlock();
spin_unlock_bh(&nf_conntrack_lock);
nfnl_unlock(); nfnl_unlock();
if (request_module("nf-nat-ipv4") < 0) { if (request_module("nf-nat-ipv4") < 0) {
nfnl_lock(); nfnl_lock();
spin_lock_bh(&nf_conntrack_lock);
rcu_read_lock(); rcu_read_lock();
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
nfnl_lock(); nfnl_lock();
spin_lock_bh(&nf_conntrack_lock);
rcu_read_lock(); rcu_read_lock();
if (nfnetlink_parse_nat_setup_hook) if (nfnetlink_parse_nat_setup_hook)
return -EAGAIN; return -EAGAIN;