From: Francis Deslauriers Date: Wed, 17 May 2017 21:09:12 +0000 (-0400) Subject: Fix: NULL pointer dereference of THIS_MODULE with built-in modules X-Git-Tag: v2.11.0-rc1~129 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0147ae6413de42a6f254a17793414c7f25e4f28a;p=lttng-modules.git Fix: NULL pointer dereference of THIS_MODULE with built-in modules THIS MODULE is defined to 0 when a module is built-in the kernel [1]. This caused NULL pointer dereference when booting a kernel with the lttng-modules built-in. To fix this issue, add #if guard around the wrapper_lttng_fixup_sig function checking if the MODULE macro is defined to confirm that this piece of code will end up in a module and not in the kernel itself. [1]: linux/include/linux/export.h:32 Fixes: #1107 Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers --- diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h index 367cdf42..780f9a86 100644 --- a/wrapper/tracepoint.h +++ b/wrapper/tracepoint.h @@ -87,6 +87,10 @@ int wrapper_tracepoint_module_notify(struct notifier_block *nb, } } +#endif /* CONFIG_MODULE_SIG */ + +#if defined(CONFIG_MODULE_SIG) && defined(MODULE) + static inline int wrapper_lttng_fixup_sig(struct module *mod) { @@ -106,7 +110,7 @@ int wrapper_lttng_fixup_sig(struct module *mod) return ret; } -#else /* CONFIG_MODULE_SIG */ +#else /* #if defined(CONFIG_MODULE_SIG) && defined(MODULE) */ static inline int wrapper_lttng_fixup_sig(struct module *mod) @@ -114,6 +118,6 @@ int wrapper_lttng_fixup_sig(struct module *mod) return 0; } -#endif /* #else CONFIG_MODULE_SIG */ +#endif /*#else #if defined(CONFIG_MODULE_SIG) && defined(MODULE) */ #endif /* _LTTNG_WRAPPER_TRACEPOINT_H */