It's possible that a pid has died before we take the rcu lock, in which
case we can't walk the ancestry list as it may be detached. Instead, check
for death first before doing the walk.
Fixes: 2d514487 ("security: Yama LSM")
Suggested-by: Oleg Nesterov <firstname.lastname@example.org>
Signed-off-by: Kees Cook <email@example.com>
Signed-off-by: James Morris <firstname.lastname@example.org>