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

Commit 06608603 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Greg Kroah-Hartman
Browse files

netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger



[ Upstream commit 259eb32971e9eb24d1777a28d82730659f50fdcb ]

Module reference is bumped for each user, this should not ever happen.

But BUG_ON check should use rcu_access_pointer() instead.

If this ever happens, do WARN_ON_ONCE() instead of BUG_ON() and
consolidate pointer check under the rcu read side lock section.

Fixes: fab4085f ("netfilter: log: nf_log_packet() as real unified interface")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 64babb17
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -203,10 +203,11 @@ void nf_logger_put(int pf, enum nf_log_type type)
		return;
	}

	BUG_ON(loggers[pf][type] == NULL);

	rcu_read_lock();
	logger = rcu_dereference(loggers[pf][type]);
	if (!logger)
		WARN_ON_ONCE(1);
	else
		module_put(logger->me);
	rcu_read_unlock();
}