netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>, Florian Westphal <fw@strlen.de>
Subject: [PATCH 2/5] netfilter: nfnetlink_queue: avoid peer_portid test
Date: Tue, 16 Apr 2013 17:32:05 +0200	[thread overview]
Message-ID: <1366126328-25874-3-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1366126328-25874-1-git-send-email-fw@strlen.de>

The portid is the netlink port id of the skb that created the queue.

Add test to ensure the portid cannot be 0 at create time, and
the check at enqueue time will always be false.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nfnetlink_queue_core.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 5e280b3..94e2e4f 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -107,6 +107,9 @@ instance_create(struct nfnl_queue_net *q, u_int16_t queue_num,
 	unsigned int h;
 	int err;
 
+	if (portid == 0)
+		return ERR_PTR(-EINVAL);
+
 	spin_lock(&q->instances_lock);
 	if (instance_lookup(q, queue_num)) {
 		err = -EEXIST;
@@ -506,10 +509,6 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
 	}
 	spin_lock_bh(&queue->lock);
 
-	if (!queue->peer_portid) {
-		err = -EINVAL;
-		goto err_out_free_nskb;
-	}
 	if (queue->queue_total >= queue->queue_maxlen) {
 		if (queue->flags & NFQA_CFG_F_FAIL_OPEN) {
 			failopen = 1;
-- 
1.7.8.6


  parent reply	other threads:[~2013-04-16 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 15:32 [PATCH -next 0/5] netfilter: nf_queue: avoid expensive gso/checksumming Florian Westphal
2013-04-16 15:32 ` [PATCH 1/5] netfilter: nf_queue: move device refcount bump to extra function Florian Westphal
2013-04-16 15:32 ` Florian Westphal [this message]
2013-04-16 15:32 ` [PATCH 3/5] netfilter: move skb_gso_segment into nfnetlink_queue module Florian Westphal
2013-04-16 15:32 ` [PATCH 4/5] netfilter: nfnetlink_queue: add skb info attribute Florian Westphal
2013-04-16 15:55   ` Eric Dumazet
2013-04-16 17:47     ` Florian Westphal
2013-04-16 15:32 ` [PATCH 5/5] netfilter: nfqueue: avoid expensive gso segmentation and checksum fixup Florian Westphal
  -- strict thread matches above, loose matches on Subject: below --
2013-04-19 14:58 [PATCH -next v2 0/5] netfilter: nf_queue: avoid expensive gso/checksums Florian Westphal
2013-04-19 14:58 ` [PATCH 2/5] netfilter: nfnetlink_queue: avoid peer_portid test Florian Westphal
2013-04-26  1:19   ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366126328-25874-3-git-send-email-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=eric.dumazet@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).