[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5952b626-ef08-4293-8a73-f1496af4e987@stanley.mountain>
Date: Wed, 11 Dec 2024 12:21:39 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Amir Goldstein <amir73il@...il.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Kees Cook <kees@...nel.org>, Eric Biederman <ebiederm@...ssion.com>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH next] binfmt_elf: Fix potential Oops in load_elf_binary()
This function call was changed from allow_write_access() which has a NULL
check to exe_file_allow_write_access() which doesn't. Check for NULL
before calling it.
Fixes: 871387b27c20 ("fs: don't block write during exec on pre-content watched files")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
fs/binfmt_elf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 8054f44d39cf..db9cb4c20125 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1354,9 +1354,10 @@ static int load_elf_binary(struct linux_binprm *bprm)
kfree(interp_elf_ex);
kfree(interp_elf_phdata);
out_free_file:
- exe_file_allow_write_access(interpreter);
- if (interpreter)
+ if (interpreter) {
+ exe_file_allow_write_access(interpreter);
fput(interpreter);
+ }
out_free_ph:
kfree(elf_phdata);
goto out;
--
2.45.2
Powered by blists - more mailing lists