Skip to contentSkip to conversation

module: tracking: Keep a record of tainted unloaded modules only

PATCH In review Aaron Tomlin 2 participants 2 messages Oct 7, 2022 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: tracking: Keep a record of tainted unloaded modules only

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

Fixes 99bd9956551b ("module: Introduce module unload taint tracking")
---
 kernel/module/tracking.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/module/tracking.c +3 -0
index a139e63b6f20..26d812e07615 100644
@@ -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) &&
Signature · 1 line
2.37.3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Aaron Tomlin

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

Fixes 99bd9956551b ("module: Introduce module unload taint tracking")

Linus, this is the patch I mentioned Aaron was going to post, if I can trouble you to merge that after my pull request, that would be great.

Thanks!

Luis