From: Aaron Tomlin Date: Fri, 7 Oct 2022 13:38:12 +0000 (+0100) Subject: module: tracking: Keep a record of tainted unloaded modules only X-Git-Tag: v5.19.17~178 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1bfec0f742c379e7318c9a3fb2f3d313256c0ba;p=thirdparty%2Fkernel%2Fstable.git module: tracking: Keep a record of tainted unloaded modules only [ Upstream commit 47cc75aa92837a9d3f15157d6272ff285585d75d ] 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 Fixes: 99bd9956551b ("module: Introduce module unload taint tracking") Signed-off-by: Aaron Tomlin Acked-by: Luis Chamberlain Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c index 7f8133044d092..af52cabfe6321 100644 --- a/kernel/module/tracking.c +++ b/kernel/module/tracking.c @@ -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) &&