[PATCH 3/3] module: Move mod_unload_taint to tracking.c

From: Petr Pavlu

Date: Tue Oct 20 2026 - 10:55:46 EST


Move the definition of mod_unload_taint from internal.h to tracking.c, as
it doesn't need to be exposed to other module code, and remove the
redundant declaration of mod_debugfs_root from tracking.c, as it is already
declared in internal.h.

This is a non-functional change.

Signed-off-by: Petr Pavlu <petr.pavlu@xxxxxxxx>
---
kernel/module/internal.h | 13 -------------
kernel/module/tracking.c | 14 +++++++++++++-
2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/kernel/module/internal.h b/kernel/module/internal.h
index 70ef20b97c84..3aca22253296 100644
--- a/kernel/module/internal.h
+++ b/kernel/module/internal.h
@@ -253,19 +253,6 @@ static inline void kmod_dup_request_announce(char *module_name, int ret)
#endif

#ifdef CONFIG_MODULE_UNLOAD_TAINT_TRACKING
-struct mod_unload_taint {
- struct list_head list;
- char name[MODULE_NAME_LEN];
- unsigned long taints;
-
- /*
- * Number of times a module with this name and taint combination has
- * been unloaded. Updates are serialized by module_mutex and use
- * WRITE_ONCE(). Readers that may run concurrently use READ_ONCE().
- */
- unsigned int count;
-};
-
int try_add_tainted_module(struct module *mod);
void print_unloaded_tainted_modules(void);
#else /* !CONFIG_MODULE_UNLOAD_TAINT_TRACKING */
diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c
index 873fceb30526..46840dc22dcb 100644
--- a/kernel/module/tracking.c
+++ b/kernel/module/tracking.c
@@ -14,8 +14,20 @@
#include <linux/rculist.h>
#include "internal.h"

+struct mod_unload_taint {
+ struct list_head list;
+ char name[MODULE_NAME_LEN];
+ unsigned long taints;
+
+ /*
+ * Number of times a module with this name and taint combination has
+ * been unloaded. Updates are serialized by module_mutex and use
+ * WRITE_ONCE(). Readers that may run concurrently use READ_ONCE().
+ */
+ unsigned int count;
+};
+
static LIST_HEAD(unloaded_tainted_modules);
-extern struct dentry *mod_debugfs_root;

int try_add_tainted_module(struct module *mod)
{

--
2.55.0