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

Commit 0699a566 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Steve Muckle
Browse files

sched: initialize env->flags variable to 0



env->flags and env->new_dst_cpu fields are not initialized in
load_balance() function. As a result, load_balance() could wrongly see
LBF_SOME_PINNED flag set and access (bogus) new_dst_cpu's runqueue
leading to invalid memory reference. Fix this by initializing
env->flags field to 0. While we are at it, fix similar issue in
active_load_balance_cpu_stop() function, although there is no harm
present currently in that function with uninitialized env->flags
variable.

Change-Id: Ied470b0abd65bf2ecfa33fa991ba554a5393f649
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
parent 098d8371
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6356,6 +6356,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
		.idle		= idle,
		.loop_break	= sched_nr_migrate_break,
		.cpus		= cpus,
		.flags		= 0,
	};

	/*
@@ -6695,6 +6696,7 @@ static int active_load_balance_cpu_stop(void *data)
		.src_cpu	= busiest_rq->cpu,
		.src_rq		= busiest_rq,
		.idle		= CPU_IDLE,
		.flags		= 0,
	};

	raw_spin_lock_irq(&busiest_rq->lock);