mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
Fix unbalanced helper_lock in kernel/kmod.c
call_usermodehelper_exec() has an exit path that can leave the helper_lock() call at the top of the routine unbalanced. The attached patch fixes this issue. Signed-off-by: Nigel Cunningham <nigel@tuxonice.net> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
34aebfd3bd
commit
784680336b
1 changed files with 6 additions and 7 deletions
|
@ -451,13 +451,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
|
||||||
enum umh_wait wait)
|
enum umh_wait wait)
|
||||||
{
|
{
|
||||||
DECLARE_COMPLETION_ONSTACK(done);
|
DECLARE_COMPLETION_ONSTACK(done);
|
||||||
int retval;
|
int retval = 0;
|
||||||
|
|
||||||
helper_lock();
|
helper_lock();
|
||||||
if (sub_info->path[0] == '\0') {
|
if (sub_info->path[0] == '\0')
|
||||||
retval = 0;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
if (!khelper_wq || usermodehelper_disabled) {
|
if (!khelper_wq || usermodehelper_disabled) {
|
||||||
retval = -EBUSY;
|
retval = -EBUSY;
|
||||||
|
@ -468,13 +466,14 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
|
||||||
sub_info->wait = wait;
|
sub_info->wait = wait;
|
||||||
|
|
||||||
queue_work(khelper_wq, &sub_info->work);
|
queue_work(khelper_wq, &sub_info->work);
|
||||||
if (wait == UMH_NO_WAIT) /* task has freed sub_info */
|
if (wait == UMH_NO_WAIT) /* task has freed sub_info */
|
||||||
return 0;
|
goto unlock;
|
||||||
wait_for_completion(&done);
|
wait_for_completion(&done);
|
||||||
retval = sub_info->retval;
|
retval = sub_info->retval;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
call_usermodehelper_freeinfo(sub_info);
|
call_usermodehelper_freeinfo(sub_info);
|
||||||
|
unlock:
|
||||||
helper_unlock();
|
helper_unlock();
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue