Skip to content

Commit 9121935

Browse files
Tetsuo Handatorvalds
authored andcommitted
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>
1 parent aacb3d1 commit 9121935

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/exec.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,8 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
14401440
printable(bprm->buf[2]) &&
14411441
printable(bprm->buf[3]))
14421442
break; /* -ENOEXEC */
1443+
if (try)
1444+
break; /* -ENOEXEC */
14431445
request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
14441446
#endif
14451447
}

0 commit comments

Comments
 (0)