提交 83370b31 编写于 作者: T Tianyue Ren 提交者: Paul Moore

selinux: fix error initialization in inode_doinit_with_dentry()

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: 9287aed2 ("selinux: Convert isec->lock into a spinlock")
Signed-off-by: NTianyue Ren <rentianyue@kylinos.cn>
[PM: minor comment tweaks]
Signed-off-by: NPaul Moore <paul@paul-moore.com>
上级 3650b228
...@@ -1451,7 +1451,13 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent ...@@ -1451,7 +1451,13 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
* inode_doinit with a dentry, before these inodes could * inode_doinit with a dentry, before these inodes could
* be used again by userspace. * be used again by userspace.
*/ */
goto out; isec->initialized = LABEL_INVALID;
/*
* There is nothing useful to jump to the "out"
* label, except a needless spin lock/unlock
* cycle.
*/
return 0;
} }
rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid, rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid,
...@@ -1507,8 +1513,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent ...@@ -1507,8 +1513,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
* inode_doinit() with a dentry, before these inodes * inode_doinit() with a dentry, before these inodes
* could be used again by userspace. * could be used again by userspace.
*/ */
if (!dentry) if (!dentry) {
goto out; isec->initialized = LABEL_INVALID;
/*
* There is nothing useful to jump to the "out"
* label, except a needless spin lock/unlock
* cycle.
*/
return 0;
}
rc = selinux_genfs_get_sid(dentry, sclass, rc = selinux_genfs_get_sid(dentry, sclass,
sbsec->flags, &sid); sbsec->flags, &sid);
if (rc) { if (rc) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册