Messages in this thread Patch in this message | | | From | Jarkko Sakkinen <> | Subject | [PATCH v4 1/7] module: Add lock_modules() and unlock_modules() | Date | Fri, 17 Jul 2020 06:04:15 +0300 |
| |
Add wrapper functions for acquiring module_mutex so that the locking can be implicitly compiled out when CONFIG_MODULES is not enabled.
Cc: Andi Kleen <ak@linux.intel.com> Suggested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> --- include/linux/module.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/include/linux/module.h b/include/linux/module.h index 2e6670860d27..8850b9692b8f 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -705,6 +705,16 @@ static inline bool is_livepatch_module(struct module *mod) bool is_module_sig_enforced(void); void set_module_sig_enforced(void); +static inline void lock_modules(void) +{ + mutex_lock(&module_mutex); +} + +static inline void unlock_modules(void) +{ + mutex_unlock(&module_mutex); +} + #else /* !CONFIG_MODULES... */ static inline struct module *__module_address(unsigned long addr) @@ -852,6 +862,14 @@ void *dereference_module_function_descriptor(struct module *mod, void *ptr) return ptr; } +static inline void lock_modules(void) +{ +} + +static inline void unlock_modules(void) +{ +} + #endif /* CONFIG_MODULES */ #ifdef CONFIG_SYSFS -- 2.25.1
| |