From: Tetsuo Handa Date: Tue, 26 Jul 2011 23:08:41 +0000 (-0700) Subject: exec: do not call request_module() twice from search_binary_handler() X-Git-Tag: firefly_0821_release~7541^2~2604 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2b7eea63de50d738ae12a1bf84b76ef91c007a0e;p=firefly-linux-kernel-4.4.55.git exec: do not call request_module() twice from search_binary_handler() 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 Reported-by: Richard Weinberger Tested-by: Richard Weinberger Cc: Al Viro Signed-off-by: Andrew Morton Cc: Maxim Uvarov Signed-off-by: Linus Torvalds --- diff --git a/fs/exec.c b/fs/exec.c index 6075a1e727ae..044c13ffdc42 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1411,6 +1411,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 }