]> git.itanic.dy.fi Git - linux-stable/commit
include/linux/sched/mm.h: use rcu_dereference in in_vfork()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 13 Mar 2021 05:08:03 +0000 (21:08 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:11:43 +0000 (17:11 +0100)
commit86a41a3b2ed7fda7e8641108c03bfc52cd07258b
tree9b51e38fdd159617b41326d6b090e6ce03626d8a
parent17e14c8a01ca681d5afbd245081ff5b1c5fa26b4
include/linux/sched/mm.h: use rcu_dereference in in_vfork()

[ Upstream commit 149fc787353f65b7e72e05e7b75d34863266c3e2 ]

Fix a sparse warning by using rcu_dereference().  Technically this is a
bug and a sufficiently aggressive compiler could reload the `real_parent'
pointer outside the protection of the rcu lock (and access freed memory),
but I think it's pretty unlikely to happen.

Link: https://lkml.kernel.org/r/20210221194207.1351703-1-willy@infradead.org
Fixes: b18dc5f291c0 ("mm, oom: skip vforked tasks from being selected")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/sched/mm.h