From aa0d1564b10f9165f913229d4428bdeea4e0d945 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Mon, 6 Apr 2020 20:11:32 -0700 Subject: [PATCH] fs/binfmt_elf.c: don't free interpreter's ELF pheaders on common path Static executables don't need to free NULL pointer. It doesn't matter really because static executable is not common scenario but do it anyway out of pedantry. Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Link: http://lkml.kernel.org/r/20200219185330.GA4933@avx2 Signed-off-by: Linus Torvalds --- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index a3a9429ef1d2..13f25e241ac4 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1076,6 +1076,7 @@ static int load_elf_binary(struct linux_binprm *bprm) fput(interpreter); kfree(interp_elf_ex); + kfree(interp_elf_phdata); } else { elf_entry = e_entry; if (BAD_ADDR(elf_entry)) { @@ -1084,7 +1085,6 @@ static int load_elf_binary(struct linux_binprm *bprm) } } - kfree(interp_elf_phdata); kfree(elf_phdata); set_binfmt(&elf_format);