diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -74,6 +74,8 @@ static DEFINE_RWLOCK(binfmt_lock); | |||
74 | void __register_binfmt(struct linux_binfmt * fmt, int insert) | 74 | void __register_binfmt(struct linux_binfmt * fmt, int insert) |
75 | { | 75 | { |
76 | BUG_ON(!fmt); | 76 | BUG_ON(!fmt); |
77 | if (WARN_ON(!fmt->load_binary)) | ||
78 | return; | ||
77 | write_lock(&binfmt_lock); | 79 | write_lock(&binfmt_lock); |
78 | insert ? list_add(&fmt->lh, &formats) : | 80 | insert ? list_add(&fmt->lh, &formats) : |
79 | list_add_tail(&fmt->lh, &formats); | 81 | list_add_tail(&fmt->lh, &formats); |
@@ -1389,14 +1391,11 @@ int search_binary_handler(struct linux_binprm *bprm) | |||
1389 | for (try=0; try<2; try++) { | 1391 | for (try=0; try<2; try++) { |
1390 | read_lock(&binfmt_lock); | 1392 | read_lock(&binfmt_lock); |
1391 | list_for_each_entry(fmt, &formats, lh) { | 1393 | list_for_each_entry(fmt, &formats, lh) { |
1392 | int (*fn)(struct linux_binprm *) = fmt->load_binary; | ||
1393 | if (!fn) | ||
1394 | continue; | ||
1395 | if (!try_module_get(fmt->module)) | 1394 | if (!try_module_get(fmt->module)) |
1396 | continue; | 1395 | continue; |
1397 | read_unlock(&binfmt_lock); | 1396 | read_unlock(&binfmt_lock); |
1398 | bprm->recursion_depth++; | 1397 | bprm->recursion_depth++; |
1399 | retval = fn(bprm); | 1398 | retval = fmt->load_binary(bprm); |
1400 | bprm->recursion_depth--; | 1399 | bprm->recursion_depth--; |
1401 | if (retval >= 0) { | 1400 | if (retval >= 0) { |
1402 | put_binfmt(fmt); | 1401 | put_binfmt(fmt); |