提交 b127125d 编写于 作者: A Al Viro

fix breakage caused by d_find_alias() semantics change

"VFS: don't keep disconnected dentries on d_anon" had a non-trivial
side-effect - d_unhashed() now returns true for those dentries,
making d_find_alias() skip them altogether.  For most of its callers
that's fine - we really want a connected alias there.  However,
there is a codepath where we relied upon picking such aliases
if nothing else could be found - selinux delayed initialization
of contexts for inodes on already mounted filesystems used to
rely upon that.

Cc: stable@kernel.org # f1ee6162 "VFS: don't keep disconnected dentries on d_anon"
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 79f546a6
...@@ -1568,8 +1568,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent ...@@ -1568,8 +1568,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
/* Called from d_instantiate or d_splice_alias. */ /* Called from d_instantiate or d_splice_alias. */
dentry = dget(opt_dentry); dentry = dget(opt_dentry);
} else { } else {
/* Called from selinux_complete_init, try to find a dentry. */ /*
* Called from selinux_complete_init, try to find a dentry.
* Some filesystems really want a connected one, so try
* that first. We could split SECURITY_FS_USE_XATTR in
* two, depending upon that...
*/
dentry = d_find_alias(inode); dentry = d_find_alias(inode);
if (!dentry)
dentry = d_find_any_alias(inode);
} }
if (!dentry) { if (!dentry) {
/* /*
...@@ -1674,14 +1681,19 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent ...@@ -1674,14 +1681,19 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) { if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) {
/* We must have a dentry to determine the label on /* We must have a dentry to determine the label on
* procfs inodes */ * procfs inodes */
if (opt_dentry) if (opt_dentry) {
/* Called from d_instantiate or /* Called from d_instantiate or
* d_splice_alias. */ * d_splice_alias. */
dentry = dget(opt_dentry); dentry = dget(opt_dentry);
else } else {
/* Called from selinux_complete_init, try to /* Called from selinux_complete_init, try to
* find a dentry. */ * find a dentry. Some filesystems really want
* a connected one, so try that first.
*/
dentry = d_find_alias(inode); dentry = d_find_alias(inode);
if (!dentry)
dentry = d_find_any_alias(inode);
}
/* /*
* This can be hit on boot when a file is accessed * This can be hit on boot when a file is accessed
* before the policy is loaded. When we load policy we * before the policy is loaded. When we load policy we
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册