mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 07:11:03 +02:00
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>
This commit is contained in:
parent
ae324a7192
commit
10dde2bd66
|
|
@ -29,6 +29,7 @@
|
|||
#include <linux/srcu.h>
|
||||
#include <linux/static_call_types.h>
|
||||
#include <linux/dynamic_debug.h>
|
||||
#include <linux/panic.h>
|
||||
|
||||
#include <linux/percpu.h>
|
||||
#include <asm/module.h>
|
||||
|
|
@ -770,6 +771,9 @@ static inline bool is_livepatch_module(struct module *mod)
|
|||
|
||||
void module_for_each_mod(int(*func)(struct module *mod, void *data), void *data);
|
||||
|
||||
void add_taint_module(struct module *mod, unsigned flag,
|
||||
enum lockdep_ok lockdep_ok);
|
||||
|
||||
#else /* !CONFIG_MODULES... */
|
||||
|
||||
static inline struct module *__module_address(unsigned long addr)
|
||||
|
|
@ -877,6 +881,12 @@ static inline bool module_is_coming(struct module *mod)
|
|||
static inline void module_for_each_mod(int(*func)(struct module *mod, void *data), void *data)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void add_taint_module(struct module *mod, unsigned flag,
|
||||
enum lockdep_ok lockdep_ok)
|
||||
{
|
||||
add_taint(flag, lockdep_ok);
|
||||
}
|
||||
#endif /* CONFIG_MODULES */
|
||||
|
||||
#ifdef CONFIG_SYSFS
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user