sched/core: Fix null-pointer dereference

Turning on sched_use_pelt causes a null-pointer dereference in
scheduler. Add correct checking of varable.

CRs-fixed: 1042656
Change-Id: I6e6a57e24b41e4b3d049bfcf694b9ad7e2144dd5
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
This commit is contained in:
Olav Haugan 2016-07-16 10:39:06 -07:00
parent 4e24c748ee
commit e3473cacaa

View file

@ -4343,7 +4343,7 @@ __update_load_avg(u64 now, int cpu, struct sched_avg *sa,
return 0;
sa->last_update_time = now;
if (sched_use_pelt && !cfs_rq && weight) {
if (sched_use_pelt && cfs_rq && weight) {
se = container_of(sa, struct sched_entity, avg);
if (entity_is_task(se) && se->on_rq)
dec_hmp_sched_stats_fair(rq_of(cfs_rq), task_of(se));