Commit bcb421ea authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix kmod return value

From: Rusty Russell <rusty@rustcorp.com.au>

Milton Miller <miltonm@bga.com> and Junfeng Yang <yjf@stanford.edu> point
out that we hand a kernel address to sys_wait4 for the status pointer.
This is true, but since we don't have a SIGCHLD handler, it never gets that
far.  Use NULL, and document the fact.
parent bf93adba
...@@ -183,12 +183,15 @@ static int wait_for_helper(void *data) ...@@ -183,12 +183,15 @@ static int wait_for_helper(void *data)
struct subprocess_info *sub_info = data; struct subprocess_info *sub_info = data;
pid_t pid; pid_t pid;
pid = kernel_thread(____call_usermodehelper, sub_info, sub_info->retval = 0;
CLONE_VFORK | SIGCHLD); pid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD);
if (pid < 0) if (pid < 0)
sub_info->retval = pid; sub_info->retval = pid;
else else
sys_wait4(pid, (unsigned int *)&sub_info->retval, 0, NULL); /* We don't have a SIGCHLD signal handler, so this
* always returns -ECHILD, but the important thing is
* that it blocks. */
sys_wait4(pid, NULL, 0, NULL);
complete(sub_info->complete); complete(sub_info->complete);
return 0; return 0;
...@@ -231,8 +234,7 @@ static void __call_usermodehelper(void *data) ...@@ -231,8 +234,7 @@ static void __call_usermodehelper(void *data)
* (ie. it runs with full root capabilities). * (ie. it runs with full root capabilities).
* *
* Must be called from process context. Returns a negative error code * Must be called from process context. Returns a negative error code
* if program was not execed successfully, or (exitcode << 8 + signal) * if program was not execed successfully, or 0.
* of the application (0 if wait is not set).
*/ */
int call_usermodehelper(char *path, char **argv, char **envp, int wait) int call_usermodehelper(char *path, char **argv, char **envp, int wait)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment