[PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed
Liao Chang
liaochang1 at huawei.com
Wed Nov 2 18:17:13 PDT 2022
When unwind table allocation failed, it needs to reclaim the unwind list
of module to avoid potential NULL pointer exception and memory leakage.
Fixes: b6f21d14f1ac ("ARM: 9204/2: module: Add all unwind tables when load module")
Signed-off-by: Liao Chang <liaochang1 at huawei.com>
Cc: Chen Zhongjin <chenzhongjin at huawei.com>
---
arch/arm/kernel/module.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index d59c36dc0494..cc637dcdcb10 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -485,6 +485,10 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
s->sh_size,
txt_sec->sh_addr,
txt_sec->sh_size);
+ if (!table) {
+ module_arch_cleanup(mod);
+ return -ENOMEM;
+ }
list_add(&table->mod_list, unwind_list);
--
2.17.1
More information about the linux-arm-kernel
mailing list