Blame SOURCES/libnetfilter_queue-1.0.2-rh1348210.patch

ac9b9a
From 4ca06bc967d94b7b7b5a6efc76e870f0efc77e24 Mon Sep 17 00:00:00 2001
ac9b9a
From: Florian Westphal <fw@strlen.de>
ac9b9a
Date: Thu, 16 Jun 2016 15:11:32 +0200
ac9b9a
Subject: src: make nfq_open_nfnl thread-safe
ac9b9a
ac9b9a
nfq_open_nfnl uses an intermediate static object, so when it is invoked
ac9b9a
by distinct threads at the same time there is a small chance that some
ac9b9a
threads end up with another threads nfq_handle pointer stored in ->data.
ac9b9a
ac9b9a
The result is that the affected queue will be stuck because the thread
ac9b9a
that was supposed to service it is handling another/wrong queue instead.
ac9b9a
ac9b9a
Tested-by: Michal Tesar <mtesar@redhat.com>
ac9b9a
Signed-off-by: Florian Westphal <fw@strlen.de>
ac9b9a
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
ac9b9a
---
ac9b9a
 src/libnetfilter_queue.c | 9 ++++-----
ac9b9a
 1 file changed, 4 insertions(+), 5 deletions(-)
ac9b9a
ac9b9a
diff --git a/src/libnetfilter_queue.c b/src/libnetfilter_queue.c
ac9b9a
index 84184ee..5fbde5b 100644
ac9b9a
--- a/src/libnetfilter_queue.c
ac9b9a
+++ b/src/libnetfilter_queue.c
ac9b9a
@@ -216,11 +216,6 @@ static int __nfq_rcv_pkt(struct nlmsghdr *nlh, struct nfattr *nfa[],
ac9b9a
 	return qh->cb(qh, nfmsg, &nfqa, qh->data);
ac9b9a
 }
ac9b9a
 
ac9b9a
-static struct nfnl_callback pkt_cb = {
ac9b9a
-	.call		= &__nfq_rcv_pkt,
ac9b9a
-	.attr_count	= NFQA_MAX,
ac9b9a
-};
ac9b9a
-
ac9b9a
 /* public interface */
ac9b9a
 
ac9b9a
 struct nfnl_handle *nfq_nfnlh(struct nfq_handle *h)
ac9b9a
@@ -389,6 +384,10 @@ EXPORT_SYMBOL(nfq_open);
ac9b9a
  */
ac9b9a
 struct nfq_handle *nfq_open_nfnl(struct nfnl_handle *nfnlh)
ac9b9a
 {
ac9b9a
+	struct nfnl_callback pkt_cb = {
ac9b9a
+		.call		= __nfq_rcv_pkt,
ac9b9a
+		.attr_count	= NFQA_MAX,
ac9b9a
+	};
ac9b9a
 	struct nfq_handle *h;
ac9b9a
 	int err;
ac9b9a
 
ac9b9a
-- 
ac9b9a
cgit v0.12
ac9b9a