Skip to content

Commit

Permalink
module: tracking: Keep a record of tainted unloaded modules only
Browse files Browse the repository at this point in the history
[ Upstream commit 47cc75a ]

This ensures that no module record/or entry is added to the
unloaded_tainted_modules list if it does not carry a taint.

Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
Fixes: 99bd995 ("module: Introduce module unload taint tracking")
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Aaron Tomlin authored and gregkh committed Oct 21, 2022
1 parent f9efa7c commit 4ceb529
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/module/tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ int try_add_tainted_module(struct module *mod)

module_assert_mutex_or_preempt();

if (!mod->taints)
goto out;

list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list,
lockdep_is_held(&module_mutex)) {
if (!strcmp(mod_taint->name, mod->name) &&
Expand Down

0 comments on commit 4ceb529

Please sign in to comment.