linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH modules-next] module: tracking: Keep a record of tainted unloaded modules only
@ 2022-10-07 13:38 Aaron Tomlin
  2022-10-07 17:51 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Tomlin @ 2022-10-07 13:38 UTC (permalink / raw)
  To: mcgrof; +Cc: adobriyan, linux-kernel, linux-modules, atomlin

This patch 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: 99bd9956551b ("module: Introduce module unload taint tracking")

Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
 kernel/module/tracking.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c
index a139e63b6f20..26d812e07615 100644
--- a/kernel/module/tracking.c
+++ b/kernel/module/tracking.c
@@ -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) &&
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-07 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-07 13:38 [PATCH modules-next] module: tracking: Keep a record of tainted unloaded modules only Aaron Tomlin
2022-10-07 17:51 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).