Skip to content

Commit

Permalink
[PATCH] bug fix in kernel/kmod.c
Browse files Browse the repository at this point in the history
I think there is a bug in kmod.c: In __call_usermodehelper(), when
kernel_thread(wait_for_helper, ...) return success, since wait_for_helper()
might call complete() at any time, the sub_info should not be used any
more.

Normally wait_for_helper() take a long time to finish, you may not get
problem for most of the case.  But if you remove /sbin/modprobe, it may
become easier for you to get a oop in khelper.

Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Kenneth Lee authored and Linus Torvalds committed Sep 16, 2006
1 parent 1ab7a1f commit e4b69aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,12 @@ static void __call_usermodehelper(void *data)
{
struct subprocess_info *sub_info = data;
pid_t pid;
int wait = sub_info->wait;

/* CLONE_VFORK: wait until the usermode helper has execve'd
* successfully We need the data structures to stay around
* until that is done. */
if (sub_info->wait)
if (wait)
pid = kernel_thread(wait_for_helper, sub_info,
CLONE_FS | CLONE_FILES | SIGCHLD);
else
Expand All @@ -211,7 +212,7 @@ static void __call_usermodehelper(void *data)
if (pid < 0) {
sub_info->retval = pid;
complete(sub_info->complete);
} else if (!sub_info->wait)
} else if (!wait)
complete(sub_info->complete);
}

Expand Down

0 comments on commit e4b69aa

Please sign in to comment.