Skip to content

Commit b4edf8b

Browse files
Tetsuo Handatorvalds
authored andcommitted
exec: do not retry load_binary method if CONFIG_MODULES=n
If CONFIG_MODULES=n, it makes no sense to retry the list of binary formats handler because the list will not be modified by request_module(). Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: 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 9121935 commit b4edf8b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎fs/exec.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,9 +1430,9 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
14301430
}
14311431
}
14321432
read_unlock(&binfmt_lock);
1433+
#ifdef CONFIG_MODULES
14331434
if (retval != -ENOEXEC || bprm->mm == NULL) {
14341435
break;
1435-
#ifdef CONFIG_MODULES
14361436
} else {
14371437
#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
14381438
if (printable(bprm->buf[0]) &&
@@ -1443,8 +1443,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
14431443
if (try)
14441444
break; /* -ENOEXEC */
14451445
request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
1446-
#endif
14471446
}
1447+
#else
1448+
break;
1449+
#endif
14481450
}
14491451
return retval;
14501452
}

0 commit comments

Comments
 (0)