diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2019-05-14 15:44:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 19:52:50 -0700 |
commit | d53ddd0181d1c284c28c0d70a3d7039db41c6f7e (patch) | |
tree | 9c7845ae24e6235ed6bb7a054bf2c619e51aed6a /fs | |
parent | b028fb612849add771679c1b99a50d99264c9632 (diff) |
fs/exec.c: move ->recursion_depth out of critical sections
->recursion_depth is changed only by current, therefore decrementing can
be done without taking any locks.
Link: http://lkml.kernel.org/r/20190417213150.GA26474@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/exec.c b/fs/exec.c index 2e0033348d8e..d88584ebf07f 100644 --- 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); |