mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Zhongjin <chenzhongjin@huawei.com>
To: Liao Chang <liaochang1@huawei.com>, <linux@armlinux.org.uk>,
	<linus.walleij@linaro.org>, <ardb@kernel.org>, <nico@fluxnic.net>,
	<rmk+kernel@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: module: Reclaim the unwind list of module on kmalloc failed
Date: Fri, 4 Nov 2022 17:47:05 +0800	[thread overview]
Message-ID: <5ebfe6dc-326c-0c33-13dd-d2a6cb2fb11d@huawei.com> (raw)
In-Reply-To: <20221103011713.138974-1-liaochang1@huawei.com>

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.


  reply	other threads:[~2022-11-04  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  1:17 Liao Chang
2022-11-04  9:47 ` Chen Zhongjin [this message]
2022-11-08 14:05 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ebfe6dc-326c-0c33-13dd-d2a6cb2fb11d@huawei.com \
    --to=chenzhongjin@huawei.com \
    --cc=ardb@kernel.org \
    --cc=liaochang1@huawei.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nico@fluxnic.net \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®