summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-14 16:30:31 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-18 18:24:33 +0100
commit10dde2bd66889f82bb37c16fe441f0ebb1c09c24 (patch)
treeaf9e9475a9da758a204a5c03c870f497dc95c78d /kernel
parentae324a719289a66197762ee3e78fec5dea144ba7 (diff)
downloadlinux-next-10dde2bd66889f82bb37c16fe441f0ebb1c09c24.tar.gz
linux-next-10dde2bd66889f82bb37c16fe441f0ebb1c09c24.zip
module: pull out add_taint_module() to be public
Other kernel code might want to call add_taint_module() so pull it out and make it global. If modules are not enabled, this defaults to a call to add_taint(), so all is fine. Reviewed-by: Johan Hovold <johan@kernel.org> Tested-by: Johan Hovold <johan@kernel.org> Reviewed-by: Bradley Morgan <brads@mainlining.org> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260914-bind_taint-v4-1-eadf8a090903@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index d0e1e0bd2ad0..444d990c9983 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -191,11 +191,21 @@ static inline int strong_try_module_get(struct module *mod)
return -ENOENT;
}
-static inline void add_taint_module(struct module *mod, unsigned flag,
- enum lockdep_ok lockdep_ok)
+/**
+ * add_taint_module: add a taint flag if not already set for a specific module
+ * @mod: pointer to the module that caused the problem
+ * @flag: one of the TAINT_* constants.
+ * @lockdep_ok: whether lock debugging is still OK.
+ *
+ * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for
+ * some noteworthy-but-not-corrupting cases, it can be set to true.
+ */
+void add_taint_module(struct module *mod, unsigned flag,
+ enum lockdep_ok lockdep_ok)
{
add_taint(flag, lockdep_ok);
- set_bit(flag, &mod->taints);
+ if (mod)
+ set_bit(flag, &mod->taints);
}
/*