diff options
Diffstat (limited to 'kernel/kmod.c')
| -rw-r--r-- | kernel/kmod.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 9fcb53a11f87..bf0e231d9702 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
| @@ -80,16 +80,16 @@ int __request_module(bool wait, const char *fmt, ...) | |||
| 80 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ | 80 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ |
| 81 | static int kmod_loop_msg; | 81 | static int kmod_loop_msg; |
| 82 | 82 | ||
| 83 | ret = security_kernel_module_request(); | ||
| 84 | if (ret) | ||
| 85 | return ret; | ||
| 86 | |||
| 87 | va_start(args, fmt); | 83 | va_start(args, fmt); |
| 88 | ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args); | 84 | ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args); |
| 89 | va_end(args); | 85 | va_end(args); |
| 90 | if (ret >= MODULE_NAME_LEN) | 86 | if (ret >= MODULE_NAME_LEN) |
| 91 | return -ENAMETOOLONG; | 87 | return -ENAMETOOLONG; |
| 92 | 88 | ||
| 89 | ret = security_kernel_module_request(module_name); | ||
| 90 | if (ret) | ||
| 91 | return ret; | ||
| 92 | |||
| 93 | /* If modprobe needs a service that is in a module, we get a recursive | 93 | /* If modprobe needs a service that is in a module, we get a recursive |
| 94 | * loop. Limit the number of running kmod threads to max_threads/2 or | 94 | * loop. Limit the number of running kmod threads to max_threads/2 or |
| 95 | * MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method | 95 | * MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method |
| @@ -520,13 +520,15 @@ int call_usermodehelper_pipe(char *path, char **argv, char **envp, | |||
| 520 | return -ENOMEM; | 520 | return -ENOMEM; |
| 521 | 521 | ||
| 522 | ret = call_usermodehelper_stdinpipe(sub_info, filp); | 522 | ret = call_usermodehelper_stdinpipe(sub_info, filp); |
| 523 | if (ret < 0) | 523 | if (ret < 0) { |
| 524 | goto out; | 524 | call_usermodehelper_freeinfo(sub_info); |
| 525 | return ret; | ||
| 526 | } | ||
| 525 | 527 | ||
| 526 | return call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); | 528 | ret = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); |
| 529 | if (ret < 0) /* Failed to execute helper, close pipe */ | ||
| 530 | filp_close(*filp, NULL); | ||
| 527 | 531 | ||
| 528 | out: | ||
| 529 | call_usermodehelper_freeinfo(sub_info); | ||
| 530 | return ret; | 532 | return ret; |
| 531 | } | 533 | } |
| 532 | EXPORT_SYMBOL(call_usermodehelper_pipe); | 534 | EXPORT_SYMBOL(call_usermodehelper_pipe); |
