Skip to contentSkip to conversation

netfilter: cthelper: no need for rcu read side on helper creation

PATCH New Pablo Neira Ayuso 1 participant 1 message Mar 17, 2017

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: cthelper: no need for rcu read side on helper creation

This code is already protected by the nfnl_lock mutex.

---
 net/netfilter/nfnetlink_cthelper.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
net/netfilter/nfnetlink_cthelper.c +1 -6
index f0241a1e1083..3166406d68d3 100644
@@ -306,9 +306,8 @@ static int nfnl_cthelper_new(struct net *net, struct sock *nfnl,
 	if (ret < 0)
 		return ret;
 
-	rcu_read_lock();
 	for (i = 0; i < nf_ct_helper_hsize && !helper; i++) {
-		hlist_for_each_entry_rcu(cur, &nf_ct_helper_hash[i], hnode) {
+		hlist_for_each_entry(cur, &nf_ct_helper_hash[i], hnode) {
 
 			/* skip non-userspace conntrack helpers. */
 			if (!(cur->flags & NF_CT_HELPER_F_USERSPACE))
@@ -330,16 +329,12 @@ static int nfnl_cthelper_new(struct net *net, struct sock *nfnl,
 			break;
 		}
 	}
-	rcu_read_unlock();
 
 	if (helper == NULL)
 		ret = nfnl_cthelper_create(tb, &tuple);
 	else
 		ret = nfnl_cthelper_update(tb, helper);
-
-	return ret;
 err:
-	rcu_read_unlock();
 	return ret;
 }
 
Signature · 1 line
2.1.4