lkml.org 
[lkml]   [2022]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@gmail.com>

\
 
 \ /
  Last update: 2022-10-25 21:02    [W:0.128 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site