diff options
Diffstat (limited to 'kernel/kmod.c')
-rw-r--r-- | kernel/kmod.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/kmod.c b/kernel/kmod.c index 689d20f39305..25b103190364 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 |
@@ -143,7 +143,6 @@ struct subprocess_info { | |||
143 | static int ____call_usermodehelper(void *data) | 143 | static int ____call_usermodehelper(void *data) |
144 | { | 144 | { |
145 | struct subprocess_info *sub_info = data; | 145 | struct subprocess_info *sub_info = data; |
146 | enum umh_wait wait = sub_info->wait; | ||
147 | int retval; | 146 | int retval; |
148 | 147 | ||
149 | BUG_ON(atomic_read(&sub_info->cred->usage) != 1); | 148 | BUG_ON(atomic_read(&sub_info->cred->usage) != 1); |
@@ -185,14 +184,10 @@ static int ____call_usermodehelper(void *data) | |||
185 | */ | 184 | */ |
186 | set_user_nice(current, 0); | 185 | set_user_nice(current, 0); |
187 | 186 | ||
188 | if (wait == UMH_WAIT_EXEC) | ||
189 | complete(sub_info->complete); | ||
190 | |||
191 | retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); | 187 | retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); |
192 | 188 | ||
193 | /* Exec failed? */ | 189 | /* Exec failed? */ |
194 | if (wait != UMH_WAIT_EXEC) | 190 | sub_info->retval = retval; |
195 | sub_info->retval = retval; | ||
196 | do_exit(0); | 191 | do_exit(0); |
197 | } | 192 | } |
198 | 193 | ||
@@ -271,14 +266,16 @@ static void __call_usermodehelper(struct work_struct *work) | |||
271 | 266 | ||
272 | switch (wait) { | 267 | switch (wait) { |
273 | case UMH_NO_WAIT: | 268 | case UMH_NO_WAIT: |
274 | case UMH_WAIT_EXEC: | ||
275 | break; | 269 | break; |
276 | 270 | ||
277 | case UMH_WAIT_PROC: | 271 | case UMH_WAIT_PROC: |
278 | if (pid > 0) | 272 | if (pid > 0) |
279 | break; | 273 | break; |
280 | sub_info->retval = pid; | 274 | sub_info->retval = pid; |
281 | break; | 275 | /* FALLTHROUGH */ |
276 | |||
277 | case UMH_WAIT_EXEC: | ||
278 | complete(sub_info->complete); | ||
282 | } | 279 | } |
283 | } | 280 | } |
284 | 281 | ||