提交 af0d81ab 编写于 作者: Z Zheng Zucheng 提交者: Yang Yingliang

sched: Avoid sched entity null pointer panic

hulk inclusion
category: bugfix
bugzilla: 51828, https://gitee.com/openeuler/kernel/issues/I4K96G
CVE: NA

--------------------------------

In some corner case, when we throttle the last group sched entity in rq,
kernel will be panic if there is no residual sched entities in rq. So we
add a protection to prevent this case.
Signed-off-by: NZheng Zucheng <zhengzucheng@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 698ed717
......@@ -7050,7 +7050,11 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
cfs_rq->h_nr_running == cfs_rq->idle_h_nr_running)) {
throttle_qos_cfs_rq(cfs_rq);
cfs_rq = &rq->cfs;
WARN_ON(cfs_rq->nr_running == 0);
WARN(cfs_rq->nr_running == 0,
"rq->nr_running=%u, cfs_rq->idle_h_nr_running=%u\n",
rq->nr_running, cfs_rq->idle_h_nr_running);
if (unlikely(!cfs_rq->nr_running))
return NULL;
}
#endif
} while (cfs_rq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册