Skip to content

Commit 221fcbf

Browse files
zq-david-wangakpm00
authored andcommitted
module: release codetag section when module load fails
When module load fails after memory for codetag section is ready, codetag section memory will not be properly released. This causes memory leak, and if next module load happens to get the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and leads to "unable to handle page fault" BUG. Link: https://lkml.kernel.org/r/[email protected] Fixes: 0db6f8d ("alloc_tag: load module tags into separate contiguous memory") Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: David Wang <[email protected]> Acked-by: Suren Baghdasaryan <[email protected]> Cc: Petr Pavlu <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 07c9214 commit 221fcbf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/module/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info)
28292829
{
28302830
percpu_modfree(mod);
28312831
module_arch_freeing_init(mod);
2832+
codetag_free_module_sections(mod);
28322833

28332834
free_mod_mem(mod);
28342835
}

0 commit comments

Comments
 (0)