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
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 <[email protected]>
Fixes: 99bd995 ("module: Introduce module unload taint tracking")
Signed-off-by: Aaron Tomlin <[email protected]>
Acked-by: Luis Chamberlain <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Aaron Tomlin authored and torvalds committed Oct 10, 2022
1 parent 385f4a1 commit 47cc75a
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 @@ -22,6 +22,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 47cc75a

Please sign in to comment.