diff options
-rw-r--r-- | fs/exec.c | 14 | ||||
-rw-r--r-- | include/linux/binfmts.h | 2 |
2 files changed, 6 insertions, 10 deletions
@@ -1395,18 +1395,14 @@ out_ret: | |||
1395 | return retval; | 1395 | return retval; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | int set_binfmt(struct linux_binfmt *new) | 1398 | void set_binfmt(struct linux_binfmt *new) |
1399 | { | 1399 | { |
1400 | struct linux_binfmt *old = current->binfmt; | 1400 | if (current->binfmt) |
1401 | module_put(current->binfmt->module); | ||
1401 | 1402 | ||
1402 | if (new) { | ||
1403 | if (!try_module_get(new->module)) | ||
1404 | return -1; | ||
1405 | } | ||
1406 | current->binfmt = new; | 1403 | current->binfmt = new; |
1407 | if (old) | 1404 | if (new) |
1408 | module_put(old->module); | 1405 | __module_get(new->module); |
1409 | return 0; | ||
1410 | } | 1406 | } |
1411 | 1407 | ||
1412 | EXPORT_SYMBOL(set_binfmt); | 1408 | EXPORT_SYMBOL(set_binfmt); |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 2046b5b8af48..aece486ac734 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -120,7 +120,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); | |||
120 | extern int prepare_bprm_creds(struct linux_binprm *bprm); | 120 | extern int prepare_bprm_creds(struct linux_binprm *bprm); |
121 | extern void install_exec_creds(struct linux_binprm *bprm); | 121 | extern void install_exec_creds(struct linux_binprm *bprm); |
122 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); | 122 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); |
123 | extern int set_binfmt(struct linux_binfmt *new); | 123 | extern void set_binfmt(struct linux_binfmt *new); |
124 | extern void free_bprm(struct linux_binprm *); | 124 | extern void free_bprm(struct linux_binprm *); |
125 | 125 | ||
126 | #endif /* __KERNEL__ */ | 126 | #endif /* __KERNEL__ */ |