Skip to content
Snippets Groups Projects
Commit 3eb3533c authored by Cheng Jian's avatar Cheng Jian
Browse files

sched/membarrier: fix NULL poiner in membarrier_global_expedited

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I3UKOW


CVE: NA

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

In commit 150593bf ("sched/api: Introduce task_rcu_dereference() and
try_get_task_struct()"), task_rcu_dereference() returns NULL if the task
go away before rcu_read_unlock().

this cause NULL pointer in membarrier_global_expedited(), fix it.

Fixes: 08946ecc ("sched/membarrier: Fix p->mm->membarrier_state racy load")
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 9acca0f5
No related branches found
Tags 4.19.90-2106.2.0
No related merge requests found
......@@ -115,7 +115,7 @@ static int membarrier_global_expedited(void)
* scheduling a kthread.
*/
p = task_rcu_dereference(&cpu_rq(cpu)->curr);
if (p->flags & PF_KTHREAD)
if (p && p->flags & PF_KTHREAD)
continue;
__cpumask_set_cpu(cpu, tmpmask);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment