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>
Tue, 29 Dec 2020 12:46:51 +0000 (13:46 +0100)
commitce7acf72db8c4dbf7e9e9aa942ab26342a60ab7c
treeb0bb6c7b5889c3895e9718cbebc55e340233749f
parent604f1f43d62f1841c472cab2c82f73d04e32eeed
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