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

Commit fd1452eb authored by Dmitry Adamushko's avatar Dmitry Adamushko Committed by Ingo Molnar
Browse files

x86/microcode: fix sleeping function called from invalid context at kernel/mutex.c



Fix the following "sleeping function called from invalid context" bug:

...
__might_sleep
mutex_lock_nested
microcode_update_cpu
mc_sysdev_resume
__sysdev_resume
sysdev_resume
device_power_up
...

Signed-off-by: default avatarDmitry Adamushko <dmitry.adamushko@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 82b07865
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -324,10 +324,6 @@ void microcode_update_cpu(int cpu)
	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
	int err = 0;

	/* We should bind the task to the CPU */
	BUG_ON(raw_smp_processor_id() != cpu);

	mutex_lock(&microcode_mutex);
	/*
	 * Check if the system resume is in progress (uci->valid != NULL),
	 * otherwise just request a firmware:
@@ -340,11 +336,8 @@ void microcode_update_cpu(int cpu)
			err = microcode_ops->request_microcode_fw(cpu,
					&microcode_pdev->dev);
	}

	if (!err)
		microcode_ops->apply_microcode(cpu);

	mutex_unlock(&microcode_mutex);
}

static void microcode_init_cpu(int cpu)
@@ -352,7 +345,13 @@ static void microcode_init_cpu(int cpu)
	cpumask_t old = current->cpus_allowed;

	set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
	/* We should bind the task to the CPU */
	BUG_ON(raw_smp_processor_id() != cpu);

	mutex_lock(&microcode_mutex);
	microcode_update_cpu(cpu);
	mutex_unlock(&microcode_mutex);

	set_cpus_allowed_ptr(current, &old);
}