hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I3UKOW CVE: NA
--------------------------------
In commit 150593bf8693 ("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: 08946eccabb9 ("sched/membarrier: Fix p->mm->membarrier_state racy load") Signed-off-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com --- kernel/sched/membarrier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c index c4ea07e85798..ea888ddb914f 100644 --- a/kernel/sched/membarrier.c +++ b/kernel/sched/membarrier.c @@ -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);