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

Commit b2170bd2 authored by Vikram Mulukutla's avatar Vikram Mulukutla Committed by Satya Durga Srinivasu Prabhala
Browse files

sched: core: Fix possible hotplug race in set_cpus_allowed_ptr



Since a CPU may go offline after cpu_active_mask is used
to query active CPUs, set_cpus_allowed_ptr might inadverntently
pass an invalid cpu number to move_queued_task.

Fix this by ensuring that the cpumask op that uses cpu_active_mask
checks the return value.

Change-Id: Id43a629b40b72cc47773e4027d30953b3a94058d
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent ca8a1961
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1120,7 +1120,6 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,
	if (cpumask_test_cpu(task_cpu(p), &allowed_mask))
		goto out;

	dest_cpu = cpumask_any_and(cpu_valid_mask, new_mask);
	if (task_running(rq, p) || p->state == TASK_WAKING) {
		struct migration_arg arg = { p, dest_cpu };
		/* Need help from migration thread: drop lock and wait. */