Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bf6c729 authored by Florian Westphal's avatar Florian Westphal Committed by Sasha Levin
Browse files

netfilter: nf_log: don't zap all loggers on unregister



[ 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

Fixes: 30e0c6a6 ("netfilter: nf_log: prepare net namespace support for loggers")
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 2f6e5594
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -97,11 +97,15 @@ EXPORT_SYMBOL(nf_log_register);


void nf_log_unregister(struct nf_logger *logger)
void nf_log_unregister(struct nf_logger *logger)
{
{
	const struct nf_logger *log;
	int i;
	int i;


	mutex_lock(&nf_log_mutex);
	mutex_lock(&nf_log_mutex);
	for (i = 0; i < NFPROTO_NUMPROTO; i++)
	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);
			RCU_INIT_POINTER(loggers[i][logger->type], NULL);
	}
	mutex_unlock(&nf_log_mutex);
	mutex_unlock(&nf_log_mutex);
	synchronize_rcu();
	synchronize_rcu();
}
}