summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2011-07-26 16:08:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 16:49:44 -0700
commit912193521b719fbfc2f16776febf5232fe8ba261 (patch)
treedf180e94ec0595744da6eb11f6164e539c73ea91 /fs
parentaacb3d17a73f6447c04e4d769391238dcf85568d (diff)
downloadlinux-912193521b719fbfc2f16776febf5232fe8ba261.tar.bz2
exec: do not call request_module() twice from search_binary_handler()
Currently, search_binary_handler() tries to load binary loader module using request_module() if a loader for the requested program is not yet loaded. But second attempt of request_module() does not affect the result of search_binary_handler(). If request_module() triggered recursion, calling request_module() twice causes 2 to the power of MAX_KMOD_CONCURRENT (= 50) repetitions. It is not an infinite loop but is sufficient for users to consider as a hang up. Therefore, this patch changes not to call request_module() twice, making 1 to the power of MAX_KMOD_CONCURRENT repetitions in case of recursion. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: Richard Weinberger <richard@nod.at> Tested-by: Richard Weinberger <richard@nod.at> Cc: Al Viro <viro@zeniv.linux.org.uk> 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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 01829a1cb766..e6770a526f34 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1440,6 +1440,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
printable(bprm->buf[2]) &&
printable(bprm->buf[3]))
break; /* -ENOEXEC */
+ if (try)
+ break; /* -ENOEXEC */
request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
#endif
}