Skip to contentSkip to conversation

2.6.28(.1) and netlink: scheduling while atomic

DISCUSSION Kövesdi György 3 participants 5 messages Jan 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 4 lines · Kövesdi György

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.

Thanks for the report. Does this patch fix it?

net/netfilter/nf_conntrack_netlink.c +3 -0
index 3dddec6..c32a7e8 100644
@@ -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;
#2 lore raw
Quoted 1 line

Thanks for the report. Does this patch fix it?

Thanks, it works!

Regards
K. Gy.

#3 lore raw
In reply to Patrick McHardy
Quoted 11 lines · Patrick McHardy
Quoted 8 lines · Kövesdi György

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.

Thanks for the report. Does this patch fix it?

Hm, this was introduced when we fixed the problem with race condition in the conntrack creation :( It would be worth to pass it to 2.6.29-rc.

Signature · 6 lines
"Los honestos son inadaptados sociales" -- Les Luthiers

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 1 line · Patrick McHardy

Thanks for the report. Does this patch fix it?

Hm, this was introduced when we fixed the problem with race condition in the conntrack creation :( It would be worth to pass it to 2.6.29-rc.

Of course :) I'll also send it to stable once it hits upstream.