All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -stable] netfilter: nf_log: don't zap all loggers on unregister
@ 2015-12-14 12:17 Pablo Neira Ayuso
  2015-12-14 12:17 ` [PATCH -stable-3.18] netfilter: nft_compat: fix module refcount underflow Pablo Neira Ayuso
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2015-12-14 12:17 UTC (permalink / raw)
  To: netfilter-devel; +Cc: stable

From: Florian Westphal <fw@strlen.de>

[ upstream commit 205ee117d4dc4a11ac3bd9638bb9b2e839f4de9a ]

like nf_log_unset, nf_log_unregister must not reset the list of loggers.
Otherwise, a call to nf_log_unregister() will render loggers of other nf
protocols unusable:

iptables -A INPUT -j LOG
modprobe nf_log_arp ; rmmod nf_log_arp
iptables -A INPUT -j LOG
iptables: No chain/target/match by that name

Cc: <stable@vger.kernel.org> # 3.18.x
Cc: <stable@vger.kernel.org> # 4.1.x
Cc: <stable@vger.kernel.org> # 4.2.x
Fixes: 30e0c6a6be ("netfilter: nf_log: prepare net namespace support for loggers")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_log.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 675d12c..a5ebd7d 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -107,11 +107,15 @@ EXPORT_SYMBOL(nf_log_register);
 
 void nf_log_unregister(struct nf_logger *logger)
 {
+	const struct nf_logger *log;
 	int i;
 
 	mutex_lock(&nf_log_mutex);
-	for (i = 0; i < NFPROTO_NUMPROTO; i++)
-		RCU_INIT_POINTER(loggers[i][logger->type], NULL);
+	for (i = 0; i < NFPROTO_NUMPROTO; i++) {
+		log = nft_log_dereference(loggers[i][logger->type]);
+		if (log == logger)
+			RCU_INIT_POINTER(loggers[i][logger->type], NULL);
+	}
 	mutex_unlock(&nf_log_mutex);
 }
 EXPORT_SYMBOL(nf_log_unregister);
-- 
1.7.10.4


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

end of thread, other threads:[~2015-12-14 17:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 12:17 [PATCH -stable] netfilter: nf_log: don't zap all loggers on unregister Pablo Neira Ayuso
2015-12-14 12:17 ` [PATCH -stable-3.18] netfilter: nft_compat: fix module refcount underflow Pablo Neira Ayuso
2015-12-14 12:17 ` [PATCH -stable] netfilter: nft_compat: skip family comparison in case of NFPROTO_UNSPEC Pablo Neira Ayuso
2015-12-14 12:17 ` [PATCH -stable] netfilter: ipt_rpfilter: remove the nh_scope test in rpfilter_lookup_reverse Pablo Neira Ayuso
2015-12-14 17:12   ` Luis Henriques
2015-12-14 17:12     ` Luis Henriques
2015-12-14 12:17 ` [PATCH -stable] netfilter: nf_tables: fix bogus warning in nft_data_uninit() Pablo Neira Ayuso
2015-12-14 12:17 ` [PATCH -stable] netfilter: ip6t_SYNPROXY: fix NULL pointer dereference Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.