All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: nf_log: don't zap all loggers on unregister
@ 2015-09-09  0:57 Florian Westphal
  2015-09-14 12:50 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2015-09-09  0:57 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

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

Fixes: 30e0c6a6be ("netfilter: nf_log: prepare net namespace support for loggers")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 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);
-- 
2.0.5


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

* Re: [PATCH nf] netfilter: nf_log: don't zap all loggers on unregister
  2015-09-09  0:57 [PATCH nf] netfilter: nf_log: don't zap all loggers on unregister Florian Westphal
@ 2015-09-14 12:50 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2015-09-14 12:50 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Wed, Sep 09, 2015 at 02:57:21AM +0200, Florian Westphal wrote:
> 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

Applied, thanks Florian.

My scripts applies this cleanly to -stable:

3.18.x
4.1.x
4.2.x

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09  0:57 [PATCH nf] netfilter: nf_log: don't zap all loggers on unregister Florian Westphal
2015-09-14 12:50 ` 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.