* [PATCH] exec: move ->recursion_depth out of critical sections
@ 2019-04-17 21:31 Alexey Dobriyan
0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2019-04-17 21:31 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
->recursion_depth is changed only by current, therefore decrementing can be
done without taking any locks.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/exec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1652,11 +1652,13 @@ int search_binary_handler(struct linux_binprm *bprm)
if (!try_module_get(fmt->module))
continue;
read_unlock(&binfmt_lock);
+
bprm->recursion_depth++;
retval = fmt->load_binary(bprm);
+ bprm->recursion_depth--;
+
read_lock(&binfmt_lock);
put_binfmt(fmt);
- bprm->recursion_depth--;
if (retval < 0 && !bprm->mm) {
/* we got to flush_old_exec() and failed after it */
read_unlock(&binfmt_lock);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-17 21:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 21:31 [PATCH] exec: move ->recursion_depth out of critical sections Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).