selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
stable inclusion from stable-5.10.4 commit 6e5ea342fc652573d29adcdeb805081dd7253e67 bugzilla: 46903 -------------------------------- [ Upstream commit 200ea5a2 ] A previous fix, commit 83370b31 ("selinux: fix error initialization in inode_doinit_with_dentry()"), changed how failures were handled before a SELinux policy was loaded. Unfortunately that patch was potentially problematic for two reasons: it set the isec->initialized state without holding a lock, and it didn't set the inode's SELinux label to the "default" for the particular filesystem. The later can be a problem if/when a later attempt to revalidate the inode fails and SELinux reverts to the existing inode label. This patch should restore the default inode labeling that existed before the original fix, without affecting the LABEL_INVALID marking such that revalidation will still be attempted in the future. Fixes: 83370b31 ("selinux: fix error initialization in inode_doinit_with_dentry()") Reported-by: NSven Schnelle <svens@linux.ibm.com> Tested-by: NSven Schnelle <svens@linux.ibm.com> Reviewed-by: NOndrej Mosnacek <omosnace@redhat.com> Signed-off-by: NPaul Moore <paul@paul-moore.com> Signed-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NChen Jun <chenjun102@huawei.com> Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Showing
想要评论请 注册 或 登录