diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6bd9358e5e62..ae8672482e10 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1570,8 +1570,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1570 | /* Called from d_instantiate or d_splice_alias. */ | 1570 | /* Called from d_instantiate or d_splice_alias. */ |
1571 | dentry = dget(opt_dentry); | 1571 | dentry = dget(opt_dentry); |
1572 | } else { | 1572 | } else { |
1573 | /* Called from selinux_complete_init, try to find a dentry. */ | 1573 | /* |
1574 | * Called from selinux_complete_init, try to find a dentry. | ||
1575 | * Some filesystems really want a connected one, so try | ||
1576 | * that first. We could split SECURITY_FS_USE_XATTR in | ||
1577 | * two, depending upon that... | ||
1578 | */ | ||
1574 | dentry = d_find_alias(inode); | 1579 | dentry = d_find_alias(inode); |
1580 | if (!dentry) | ||
1581 | dentry = d_find_any_alias(inode); | ||
1575 | } | 1582 | } |
1576 | if (!dentry) { | 1583 | if (!dentry) { |
1577 | /* | 1584 | /* |
@@ -1676,14 +1683,19 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1676 | if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) { | 1683 | if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) { |
1677 | /* We must have a dentry to determine the label on | 1684 | /* We must have a dentry to determine the label on |
1678 | * procfs inodes */ | 1685 | * procfs inodes */ |
1679 | if (opt_dentry) | 1686 | if (opt_dentry) { |
1680 | /* Called from d_instantiate or | 1687 | /* Called from d_instantiate or |
1681 | * d_splice_alias. */ | 1688 | * d_splice_alias. */ |
1682 | dentry = dget(opt_dentry); | 1689 | dentry = dget(opt_dentry); |
1683 | else | 1690 | } else { |
1684 | /* Called from selinux_complete_init, try to | 1691 | /* Called from selinux_complete_init, try to |
1685 | * find a dentry. */ | 1692 | * find a dentry. Some filesystems really want |
1693 | * a connected one, so try that first. | ||
1694 | */ | ||
1686 | dentry = d_find_alias(inode); | 1695 | dentry = d_find_alias(inode); |
1696 | if (!dentry) | ||
1697 | dentry = d_find_any_alias(inode); | ||
1698 | } | ||
1687 | /* | 1699 | /* |
1688 | * This can be hit on boot when a file is accessed | 1700 | * This can be hit on boot when a file is accessed |
1689 | * before the policy is loaded. When we load policy we | 1701 | * before the policy is loaded. When we load policy we |