mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] Fix ____call_usermodehelper errors being silently ignored
If ____call_usermodehelper fails, we're not interested in the child process' exit value, but the real error, so let's stop wait_for_helper from overwriting it in that case. Issue discovered by Benedikt Böhm while working on a Linux-VServer usermode helper. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
3e26a423e7
commit
111dbe0c8a
1 changed files with 11 additions and 1 deletions
|
@ -176,6 +176,8 @@ static int wait_for_helper(void *data)
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
sub_info->retval = pid;
|
sub_info->retval = pid;
|
||||||
} else {
|
} else {
|
||||||
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normally it is bogus to call wait4() from in-kernel because
|
* Normally it is bogus to call wait4() from in-kernel because
|
||||||
* wait4() wants to write the exit code to a userspace address.
|
* wait4() wants to write the exit code to a userspace address.
|
||||||
|
@ -185,7 +187,15 @@ static int wait_for_helper(void *data)
|
||||||
*
|
*
|
||||||
* Thus the __user pointer cast is valid here.
|
* Thus the __user pointer cast is valid here.
|
||||||
*/
|
*/
|
||||||
sys_wait4(pid, (int __user *) &sub_info->retval, 0, NULL);
|
sys_wait4(pid, (int __user *)&ret, 0, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If ret is 0, either ____call_usermodehelper failed and the
|
||||||
|
* real error code is already in sub_info->retval or
|
||||||
|
* sub_info->retval is 0 anyway, so don't mess with it then.
|
||||||
|
*/
|
||||||
|
if (ret)
|
||||||
|
sub_info->retval = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
complete(sub_info->complete);
|
complete(sub_info->complete);
|
||||||
|
|
Loading…
Reference in a new issue