Patchwork [2/7] netfilter: nf_queue: relax NFQA_CT attribute check

login
register
mail settings
Submitter Florian Westphal
Date July 29, 2013, 1:41 p.m.
Message ID <1375105316-13216-3-git-send-email-fw@strlen.de>
Download mbox | patch
Permalink /patch/262765/
State Accepted
Headers show

Comments

Florian Westphal - July 29, 2013, 1:41 p.m.
Allow modifying attributes of the conntrack associated with a packet
without first requesting ct data via CFG_F_CONNTRACK or extra
nfnetlink_conntrack socket.

Also remove unneded rcu_read_lock; the entire function is already
protected by rcu.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nfnetlink_queue_core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Pablo Neira - July 31, 2013, 4:56 p.m.
On Mon, Jul 29, 2013 at 03:41:51PM +0200, Florian Westphal wrote:
> Allow modifying attributes of the conntrack associated with a packet
> without first requesting ct data via CFG_F_CONNTRACK or extra
> nfnetlink_conntrack socket.

Applied, thanks.

> Also remove unneded rcu_read_lock; the entire function is already
> protected by rcu.

Indeed, that code runs on call_rcu from nfnetlink.
--
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/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 971ea14..ec9de12 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -987,8 +987,7 @@  nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
 	if (entry == NULL)
 		return -ENOENT;
 
-	rcu_read_lock();
-	if (nfqa[NFQA_CT] && (queue->flags & NFQA_CFG_F_CONNTRACK))
+	if (nfqa[NFQA_CT])
 		ct = nfqnl_ct_parse(entry->skb, nfqa[NFQA_CT], &ctinfo);
 
 	if (nfqa[NFQA_PAYLOAD]) {
@@ -1002,7 +1001,6 @@  nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
 		if (ct)
 			nfqnl_ct_seq_adjust(skb, ct, ctinfo, diff);
 	}
-	rcu_read_unlock();
 
 	if (nfqa[NFQA_MARK])
 		entry->skb->mark = ntohl(nla_get_be32(nfqa[NFQA_MARK]));