Commit e4b69aa2a1bcee21f8d5e089b8682dd8aaace5eb
Committed by
Linus Torvalds
1 parent
1ab7a1f3b4
Exists in
master
and in
39 other branches
[PATCH] bug fix in kernel/kmod.c
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>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
kernel/kmod.c
... | ... | @@ -197,11 +197,12 @@ |
197 | 197 | { |
198 | 198 | struct subprocess_info *sub_info = data; |
199 | 199 | pid_t pid; |
200 | + int wait = sub_info->wait; | |
200 | 201 | |
201 | 202 | /* CLONE_VFORK: wait until the usermode helper has execve'd |
202 | 203 | * successfully We need the data structures to stay around |
203 | 204 | * until that is done. */ |
204 | - if (sub_info->wait) | |
205 | + if (wait) | |
205 | 206 | pid = kernel_thread(wait_for_helper, sub_info, |
206 | 207 | CLONE_FS | CLONE_FILES | SIGCHLD); |
207 | 208 | else |
... | ... | @@ -211,7 +212,7 @@ |
211 | 212 | if (pid < 0) { |
212 | 213 | sub_info->retval = pid; |
213 | 214 | complete(sub_info->complete); |
214 | - } else if (!sub_info->wait) | |
215 | + } else if (!wait) | |
215 | 216 | complete(sub_info->complete); |
216 | 217 | } |
217 | 218 |