Patchwork [2/6] netfilter: ctnetlink: remove incorrect spin_[un]lock_bh on NAT module autoload

login
register
mail settings
Submitter Pablo Neira
Date March 6, 2012, 11:22 a.m.
Message ID <1331032975-5303-3-git-send-email-pablo@netfilter.org>
Download mbox | patch
Permalink /patch/144924/
State Awaiting Upstream
Headers show

Comments

Pablo Neira - March 6, 2012, 11:22 a.m.
From: Pablo Neira Ayuso <pablo@netfilter.org>

Since 7d367e0, ctnetlink_new_conntrack is called without holding
the nf_conntrack_lock spinlock. Thus, ctnetlink_parse_nat_setup
does not require to release that spinlock anymore in the NAT module
autoload case.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_netlink.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
David Miller - March 6, 2012, 8:15 p.m.
From: pablo@netfilter.org
Date: Tue,  6 Mar 2012 12:22:51 +0100

> From: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> Since 7d367e0, ctnetlink_new_conntrack is called without holding
> the nf_conntrack_lock spinlock. Thus, ctnetlink_parse_nat_setup
> does not require to release that spinlock anymore in the NAT module
> autoload case.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 30c9d4c..1068769 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1041,16 +1041,13 @@  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;