mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
netfilter: nf_log: replace BUG_ON by WARN_ON_ONCE when putting logger
[ Upstream commit259eb32971] 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:fab4085f4e("netfilter: log: nf_log_packet() as real unified interface") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ce76746a1c
commit
25621b5337
|
|
@ -193,11 +193,12 @@ 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]);
|
||||
module_put(logger->me);
|
||||
if (!logger)
|
||||
WARN_ON_ONCE(1);
|
||||
else
|
||||
module_put(logger->me);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_logger_put);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user