提交 4b78041f 编写于 作者: A Andrea Arcangeli 提交者: Xie XiuQi

mm: change mm_update_next_owner() to update mm->owner with WRITE_ONCE

euler inclusion
category: bugfix
bugzilla: 10989
CVE: NA

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

The RCU reader uses rcu_dereference() inside rcu_read_lock critical
sections, so the writer shall use WRITE_ONCE. Just a cleanup, we still
rely on gcc to emit atomic writes in other places.
Signed-off-by: NAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Nzhong jiang <zhongjiang@huawei.com>
Reviewed-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5a9dbb3c
......@@ -422,7 +422,7 @@ void mm_update_next_owner(struct mm_struct *mm)
* freed task structure.
*/
if (atomic_read(&mm->mm_users) <= 1) {
mm->owner = NULL;
WRITE_ONCE(mm->owner, NULL);
return;
}
......@@ -462,7 +462,7 @@ void mm_update_next_owner(struct mm_struct *mm)
* most likely racing with swapoff (try_to_unuse()) or /proc or
* ptrace or page migration (get_task_mm()). Mark owner as NULL.
*/
mm->owner = NULL;
WRITE_ONCE(mm->owner, NULL);
return;
assign_new_owner:
......@@ -483,7 +483,7 @@ void mm_update_next_owner(struct mm_struct *mm)
put_task_struct(c);
goto retry;
}
mm->owner = c;
WRITE_ONCE(mm->owner, c);
task_unlock(c);
put_task_struct(c);
}
......
......@@ -961,7 +961,7 @@ static __always_inline void mm_clear_owner(struct mm_struct *mm,
{
#ifdef CONFIG_MEMCG
if (mm->owner == p)
mm->owner = NULL;
WRITE_ONCE(mm->owner, NULL);
#endif
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册