2009-01-21 09:39:46

by Kövesdi György

[permalink] [raw]
Subject: 2.6.28(.1) and netlink: scheduling while atomic

Hi,

The new netlink interface allows to add NAT directly to a conntrack entry.
If it is used when the moudule nf-nat-ipv4 is not loaded in, it results in
crash:
BUG: scheduling while atomic
It is in the kernels 2.6.28 and 2.6.28.1 in the function
ctnetlink_parse_nat_setup(): it calls request_module() which causes the
problem. If the module is already loaded, then there is no problem.

Regards:
K. Gy.


2009-01-21 09:55:07

by Patrick McHardy

[permalink] [raw]
Subject: Re: 2.6.28(.1) and netlink: scheduling while atomic

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 3dddec6..c32a7e8 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -831,13 +831,16 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
if (!parse_nat_setup) {
#ifdef CONFIG_MODULES
rcu_read_unlock();
+ spin_unlock_bh(&nf_conntrack_lock);
nfnl_unlock();
if (request_module("nf-nat-ipv4") < 0) {
nfnl_lock();
+ spin_lock_bh(&nf_conntrack_lock);
rcu_read_lock();
return -EOPNOTSUPP;
}
nfnl_lock();
+ spin_lock_bh(&nf_conntrack_lock);
rcu_read_lock();
if (nfnetlink_parse_nat_setup_hook)
return -EAGAIN;


Attachments:
x (682.00 B)

2009-01-21 10:28:35

by Kövesdi György

[permalink] [raw]
Subject: Re: 2.6.28(.1) and netlink: scheduling while atomic

> Thanks for the report. Does this patch fix it?
Thanks, it works!

Regards
K. Gy.