Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78468033 authored by Nigel Cunningham's avatar Nigel Cunningham Committed by Linus Torvalds
Browse files

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: default avatarNigel Cunningham <nigel@tuxonice.net>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 34aebfd3
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -451,13 +451,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
			     enum umh_wait wait)
{
	DECLARE_COMPLETION_ONSTACK(done);
	int retval;
	int retval = 0;

	helper_lock();
	if (sub_info->path[0] == '\0') {
		retval = 0;
	if (sub_info->path[0] == '\0')
		goto out;
	}

	if (!khelper_wq || usermodehelper_disabled) {
		retval = -EBUSY;
@@ -469,12 +467,13 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,

	queue_work(khelper_wq, &sub_info->work);
	if (wait == UMH_NO_WAIT)	/* task has freed sub_info */
		return 0;
		goto unlock;
	wait_for_completion(&done);
	retval = sub_info->retval;

out:
	call_usermodehelper_freeinfo(sub_info);
unlock:
	helper_unlock();
	return retval;
}