netfilter: nfnetlink_queue: reject verdict request from different portid
authorLiping Zhang <liping.zhang@spreadtrum.com>
Mon, 8 Aug 2016 14:07:27 +0000 (22:07 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 9 Aug 2016 08:39:25 +0000 (10:39 +0200)
Like NFQNL_MSG_VERDICT_BATCH do, we should also reject the verdict
request when the portid is not same with the initial portid(maybe
from another process).

Fixes: 97d32cf9440d ("netfilter: nfnetlink_queue: batch verdict support")
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_queue.c

index 5d36a0926b4a4859304fdd1808b428c87a2ee8c4..f49f45081acb2200cc8acaed205f82a3298888ba 100644 (file)
@@ -1145,10 +1145,8 @@ static int nfqnl_recv_verdict(struct net *net, struct sock *ctnl,
        struct nfnl_queue_net *q = nfnl_queue_pernet(net);
        int err;
 
-       queue = instance_lookup(q, queue_num);
-       if (!queue)
-               queue = verdict_instance_lookup(q, queue_num,
-                                               NETLINK_CB(skb).portid);
+       queue = verdict_instance_lookup(q, queue_num,
+                                       NETLINK_CB(skb).portid);
        if (IS_ERR(queue))
                return PTR_ERR(queue);