* [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed
@ 2022-11-03 1:17 Liao Chang
2022-11-04 9:47 ` Chen Zhongjin
2022-11-08 14:05 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Liao Chang @ 2022-11-03 1:17 UTC (permalink / raw)
To: linux, linus.walleij, ardb, liaochang1, nico, rmk+kernel, chenzhongjin
Cc: linux-arm-kernel, linux-kernel
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@huawei.com>
Cc: Chen Zhongjin <chenzhongjin@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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed
2022-11-03 1:17 [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed Liao Chang
@ 2022-11-04 9:47 ` Chen Zhongjin
2022-11-08 14:05 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Chen Zhongjin @ 2022-11-04 9:47 UTC (permalink / raw)
To: Liao Chang, linux, linus.walleij, ardb, nico, rmk+kernel
Cc: linux-arm-kernel, linux-kernel
On 2022/11/3 9:17, Liao Chang wrote:
> 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@huawei.com>
> Cc: Chen Zhongjin <chenzhongjin@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);
>
Looks good to me.
Reviewed-by: Chen Zhongjin <chenzhongjin@huawei.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed
2022-11-03 1:17 [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed Liao Chang
2022-11-04 9:47 ` Chen Zhongjin
@ 2022-11-08 14:05 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-11-08 14:05 UTC (permalink / raw)
To: Liao Chang
Cc: linux, ardb, nico, rmk+kernel, chenzhongjin, linux-arm-kernel,
linux-kernel
On Thu, Nov 3, 2022 at 2:20 AM Liao Chang <liaochang1@huawei.com> wrote:
> 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@huawei.com>
> Cc: Chen Zhongjin <chenzhongjin@huawei.com>
Looks good to me:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Please put this into Russells patch tracker.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-08 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 1:17 [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed Liao Chang
2022-11-04 9:47 ` Chen Zhongjin
2022-11-08 14:05 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®