aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2011-07-26 19:08:41 -0400
committerHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>2011-11-21 12:54:44 -0500
commit3b9466c0064059f2d87a3dd0e7b8ab6c161c1bc5 (patch)
tree7d3f09ac539143186fd012d479705a00c145228e /fs/exec.c
parent0dfb482d54ca8aa504742618e329d9d7a5b29672 (diff)
exec: do not call request_module() twice from search_binary_handler()
BugLink: http://bugs.launchpad.net/bugs/881420 commit 912193521b719fbfc2f16776febf5232fe8ba261 upstream. 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> Cc: Maxim Uvarov <muvarov@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index c122d78f11b..d3baab6b8bc 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1415,6 +1415,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1415 printable(bprm->buf[2]) && 1415 printable(bprm->buf[2]) &&
1416 printable(bprm->buf[3])) 1416 printable(bprm->buf[3]))
1417 break; /* -ENOEXEC */ 1417 break; /* -ENOEXEC */
1418 if (try)
1419 break; /* -ENOEXEC */
1418 request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2])); 1420 request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
1419#endif 1421#endif
1420 } 1422 }