sched/walt: Fix in walt_lb_tick

Currently, to compare cluster IDs of new and old CPUs,
new cpu's runqueue is being accessed without checking
if new cpu is valid.

Fix this by checking new cpu's validity before it is used.

Change-Id: I6a374de9690ede3d1deedb076959229b1e79b025
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
This commit is contained in:
Sai Harshini Nimmala 2022-02-19 16:15:25 -08:00 committed by Rishabh Bhatnagar
parent 97dc7487c4
commit 7906498502

View File

@ -633,10 +633,13 @@ void walt_lb_tick(struct rq *rq)
new_cpu = walt_find_energy_efficient_cpu(p, prev_cpu, 0, 1);
rcu_read_unlock();
if (new_cpu < 0)
goto out_unlock;
new_wrq = (struct walt_rq *) cpu_rq(new_cpu)->android_vendor_data1;
/* prevent active task migration to busy or same/lower capacity CPU */
if (new_cpu < 0 || !available_idle_cpu(new_cpu) ||
if (!available_idle_cpu(new_cpu) ||
new_wrq->cluster->id <= prev_wrq->cluster->id)
goto out_unlock;