[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1gys5Cvjh8cREWB@p183>
Date: Tue, 25 Oct 2022 22:02:11 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Li Zetao <lizetao1@...wei.com>
Cc: viro@...iv.linux.org.uk, ebiederm@...ssion.com,
keescook@...omium.org, akpm@...ux-foundation.org,
yi.zhang@...wei.com, chengzhihao1@...wei.com,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/binfmt_elf: Fix memory leak in load_elf_binary()
On Mon, Oct 24, 2022 at 11:44:21PM +0800, Li Zetao wrote:
> If "interp_elf_ex" fails to allocate memory in load_elf_binary(),
> the program will take the "out_free_ph" error handing path,
> resulting in "interpreter" file resource is not released.
Yes :-(
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -911,7 +911,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
> interp_elf_ex = kmalloc(sizeof(*interp_elf_ex), GFP_KERNEL);
> if (!interp_elf_ex) {
> retval = -ENOMEM;
> - goto out_free_ph;
> + goto out_free_file;
Reviewed-by: Alexey Dobriyan <adobriyan@...il.com>
Powered by blists - more mailing lists