netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags
@ 2015-11-10 16:36 Pablo Neira Ayuso
  2015-11-10 16:36 ` [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2015-11-10 16:36 UTC (permalink / raw)
  To: netfilter-devel; +Cc: kaber, netdev

nf_tables may create percpu counters from the packet path through its
dynamic set instantiation infrastructure, so we need a way to allocate
this through GFP_ATOMIC.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/linux/netdevice.h | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2c00772..e9d0c8a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2068,20 +2068,23 @@ struct pcpu_sw_netstats {
 	struct u64_stats_sync   syncp;
 };
 
-#define netdev_alloc_pcpu_stats(type)				\
-({								\
-	typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
-	if (pcpu_stats)	{					\
-		int __cpu;					\
-		for_each_possible_cpu(__cpu) {			\
-			typeof(type) *stat;			\
-			stat = per_cpu_ptr(pcpu_stats, __cpu);	\
-			u64_stats_init(&stat->syncp);		\
-		}						\
-	}							\
-	pcpu_stats;						\
+#define __netdev_alloc_pcpu_stats(type, gfp)				\
+({									\
+	typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
+	if (pcpu_stats)	{						\
+		int __cpu;						\
+		for_each_possible_cpu(__cpu) {				\
+			typeof(type) *stat;				\
+			stat = per_cpu_ptr(pcpu_stats, __cpu);		\
+			u64_stats_init(&stat->syncp);			\
+		}							\
+	}								\
+	pcpu_stats;							\
 })
 
+#define netdev_alloc_pcpu_stats(type)					\
+	__netdev_alloc_pcpu_stats(type, GFP_KERNEL);
+
 #include <linux/notifier.h>
 
 /* netdevice notifier chain. Please remember to update the rtnetlink
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP
@ 2015-11-08 23:08 Pablo Neira Ayuso
  0 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2015-11-08 23:08 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Anthony Lineham

From: Anthony Lineham <anthony.lineham@alliedtelesis.co.nz>

The uninitialized tuple structure caused incorrect hash calculation
and the lookup failed.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=106441
Signed-off-by: Anthony Lineham <anthony.lineham@alliedtelesis.co.nz>
---
Original patch posted on kernel bugzilla.

 net/ipv4/netfilter/nf_nat_pptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index 657d230..b3ca21b 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -45,7 +45,7 @@ static void pptp_nat_expected(struct nf_conn *ct,
 	struct net *net = nf_ct_net(ct);
 	const struct nf_conn *master = ct->master;
 	struct nf_conntrack_expect *other_exp;
-	struct nf_conntrack_tuple t;
+	struct nf_conntrack_tuple t = {};
 	const struct nf_ct_pptp_master *ct_pptp_info;
 	const struct nf_nat_pptp *nat_pptp_info;
 	struct nf_nat_range range;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-11-10 20:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-10 16:36 [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags Pablo Neira Ayuso
2015-11-10 16:36 ` [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso
2015-11-10 16:39   ` Pablo Neira Ayuso
2015-11-10 16:36 ` [PATCH nf 2/2] netfilter: nf_tables: add clone interface to expression operations Pablo Neira Ayuso
2015-11-10 18:30   ` Patrick McHardy
2015-11-10 18:39     ` Pablo Neira Ayuso
2015-11-10 18:58       ` Patrick McHardy
2015-11-10 18:59         ` Pablo Neira Ayuso
2015-11-10 19:05           ` Patrick McHardy
2015-11-10 20:12 ` [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags David Miller
  -- strict thread matches above, loose matches on Subject: below --
2015-11-08 23:08 [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso

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).