selinux: fix error initialization in inode_doinit_with_dentry()
authorTianyue Ren <rentianyue@kylinos.cn>
Fri, 9 Oct 2020 01:36:30 +0000 (09:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:52:58 +0000 (11:52 +0100)
commitf0d7de09261b0dd076a470b77f38678e89362bed
treeb0fea8b02d41e006ba43f84314bc5ca56dccce65
parentae3739fcfe3baf1595dac00ac8440fe4f1bd3a38
selinux: fix error initialization in inode_doinit_with_dentry()

[ Upstream commit 83370b31a915493231e5b9addc72e4bef69f8d31 ]

Mark the inode security label as invalid if we cannot find
a dentry so that we will retry later rather than marking it
initialized with the unlabeled SID.

Fixes: 9287aed2ad1f ("selinux: Convert isec->lock into a spinlock")
Signed-off-by: Tianyue Ren <rentianyue@kylinos.cn>
[PM: minor comment tweaks]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/selinux/hooks.c