Re: [PATCH] fs/binfmt_elf: Fix memory leak in load_elf_binary()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux