aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-26 18:48:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-26 20:22:07 -0400
commit9ec3a646fe09970f801ab15e0f1694060b9f19af (patch)
tree697058ca7e1671eda180a3ccc62445686fbc1a31 /security/selinux
parentc8b3fd0ce313443731e8fd6d5a541085eb465f99 (diff)
parent3cab989afd8d8d1bc3d99fef0e7ed87c31e7b647 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull fourth vfs update from Al Viro: "d_inode() annotations from David Howells (sat in for-next since before the beginning of merge window) + four assorted fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: RCU pathwalk breakage when running into a symlink overmounting something fix I_DIO_WAKEUP definition direct-io: only inc/dec inode->i_dio_count for file systems fs/9p: fix readdir() VFS: assorted d_backing_inode() annotations VFS: fs/inode.c helpers: d_inode() annotations VFS: fs/cachefiles: d_backing_inode() annotations VFS: fs library helpers: d_inode() annotations VFS: assorted weird filesystems: d_inode() annotations VFS: normal filesystems (and lustre): d_inode() annotations VFS: security/: d_inode() annotations VFS: security/: d_backing_inode() annotations VFS: net/: d_inode() annotations VFS: net/unix: d_backing_inode() annotations VFS: kernel/: d_inode() annotations VFS: audit: d_backing_inode() annotations VFS: Fix up some ->d_inode accesses in the chelsio driver VFS: Cachefiles should perform fs modifications on the top layer only VFS: AF_UNIX sockets should call mknod on the top layer only
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c36
-rw-r--r--security/selinux/selinuxfs.c2
2 files changed, 19 insertions, 19 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index c318b304ee2f..7dade28affba 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -414,7 +414,7 @@ static int sb_finish_set_opts(struct super_block *sb)
414{ 414{
415 struct superblock_security_struct *sbsec = sb->s_security; 415 struct superblock_security_struct *sbsec = sb->s_security;
416 struct dentry *root = sb->s_root; 416 struct dentry *root = sb->s_root;
417 struct inode *root_inode = root->d_inode; 417 struct inode *root_inode = d_backing_inode(root);
418 int rc = 0; 418 int rc = 0;
419 419
420 if (sbsec->behavior == SECURITY_FS_USE_XATTR) { 420 if (sbsec->behavior == SECURITY_FS_USE_XATTR) {
@@ -552,7 +552,7 @@ static int selinux_get_mnt_opts(const struct super_block *sb,
552 opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT; 552 opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT;
553 } 553 }
554 if (sbsec->flags & ROOTCONTEXT_MNT) { 554 if (sbsec->flags & ROOTCONTEXT_MNT) {
555 struct inode *root = sbsec->sb->s_root->d_inode; 555 struct inode *root = d_backing_inode(sbsec->sb->s_root);
556 struct inode_security_struct *isec = root->i_security; 556 struct inode_security_struct *isec = root->i_security;
557 557
558 rc = security_sid_to_context(isec->sid, &context, &len); 558 rc = security_sid_to_context(isec->sid, &context, &len);
@@ -608,7 +608,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
608 int rc = 0, i; 608 int rc = 0, i;
609 struct superblock_security_struct *sbsec = sb->s_security; 609 struct superblock_security_struct *sbsec = sb->s_security;
610 const char *name = sb->s_type->name; 610 const char *name = sb->s_type->name;
611 struct inode *inode = sbsec->sb->s_root->d_inode; 611 struct inode *inode = d_backing_inode(sbsec->sb->s_root);
612 struct inode_security_struct *root_isec = inode->i_security; 612 struct inode_security_struct *root_isec = inode->i_security;
613 u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0; 613 u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0;
614 u32 defcontext_sid = 0; 614 u32 defcontext_sid = 0;
@@ -835,8 +835,8 @@ static int selinux_cmp_sb_context(const struct super_block *oldsb,
835 if ((oldflags & DEFCONTEXT_MNT) && old->def_sid != new->def_sid) 835 if ((oldflags & DEFCONTEXT_MNT) && old->def_sid != new->def_sid)
836 goto mismatch; 836 goto mismatch;
837 if (oldflags & ROOTCONTEXT_MNT) { 837 if (oldflags & ROOTCONTEXT_MNT) {
838 struct inode_security_struct *oldroot = oldsb->s_root->d_inode->i_security; 838 struct inode_security_struct *oldroot = d_backing_inode(oldsb->s_root)->i_security;
839 struct inode_security_struct *newroot = newsb->s_root->d_inode->i_security; 839 struct inode_security_struct *newroot = d_backing_inode(newsb->s_root)->i_security;
840 if (oldroot->sid != newroot->sid) 840 if (oldroot->sid != newroot->sid)
841 goto mismatch; 841 goto mismatch;
842 } 842 }
@@ -886,16 +886,16 @@ static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
886 if (!set_fscontext) 886 if (!set_fscontext)
887 newsbsec->sid = sid; 887 newsbsec->sid = sid;
888 if (!set_rootcontext) { 888 if (!set_rootcontext) {
889 struct inode *newinode = newsb->s_root->d_inode; 889 struct inode *newinode = d_backing_inode(newsb->s_root);
890 struct inode_security_struct *newisec = newinode->i_security; 890 struct inode_security_struct *newisec = newinode->i_security;
891 newisec->sid = sid; 891 newisec->sid = sid;
892 } 892 }
893 newsbsec->mntpoint_sid = sid; 893 newsbsec->mntpoint_sid = sid;
894 } 894 }
895 if (set_rootcontext) { 895 if (set_rootcontext) {
896 const struct inode *oldinode = oldsb->s_root->d_inode; 896 const struct inode *oldinode = d_backing_inode(oldsb->s_root);
897 const struct inode_security_struct *oldisec = oldinode->i_security; 897 const struct inode_security_struct *oldisec = oldinode->i_security;
898 struct inode *newinode = newsb->s_root->d_inode; 898 struct inode *newinode = d_backing_inode(newsb->s_root);
899 struct inode_security_struct *newisec = newinode->i_security; 899 struct inode_security_struct *newisec = newinode->i_security;
900 900
901 newisec->sid = oldisec->sid; 901 newisec->sid = oldisec->sid;
@@ -1610,7 +1610,7 @@ static inline int dentry_has_perm(const struct cred *cred,
1610 struct dentry *dentry, 1610 struct dentry *dentry,
1611 u32 av) 1611 u32 av)
1612{ 1612{
1613 struct inode *inode = dentry->d_inode; 1613 struct inode *inode = d_backing_inode(dentry);
1614 struct common_audit_data ad; 1614 struct common_audit_data ad;
1615 1615
1616 ad.type = LSM_AUDIT_DATA_DENTRY; 1616 ad.type = LSM_AUDIT_DATA_DENTRY;
@@ -1625,7 +1625,7 @@ static inline int path_has_perm(const struct cred *cred,
1625 const struct path *path, 1625 const struct path *path,
1626 u32 av) 1626 u32 av)
1627{ 1627{
1628 struct inode *inode = path->dentry->d_inode; 1628 struct inode *inode = d_backing_inode(path->dentry);
1629 struct common_audit_data ad; 1629 struct common_audit_data ad;
1630 1630
1631 ad.type = LSM_AUDIT_DATA_PATH; 1631 ad.type = LSM_AUDIT_DATA_PATH;
@@ -1753,7 +1753,7 @@ static int may_link(struct inode *dir,
1753 int rc; 1753 int rc;
1754 1754
1755 dsec = dir->i_security; 1755 dsec = dir->i_security;
1756 isec = dentry->d_inode->i_security; 1756 isec = d_backing_inode(dentry)->i_security;
1757 1757
1758 ad.type = LSM_AUDIT_DATA_DENTRY; 1758 ad.type = LSM_AUDIT_DATA_DENTRY;
1759 ad.u.dentry = dentry; 1759 ad.u.dentry = dentry;
@@ -1797,7 +1797,7 @@ static inline int may_rename(struct inode *old_dir,
1797 int rc; 1797 int rc;
1798 1798
1799 old_dsec = old_dir->i_security; 1799 old_dsec = old_dir->i_security;
1800 old_isec = old_dentry->d_inode->i_security; 1800 old_isec = d_backing_inode(old_dentry)->i_security;
1801 old_is_dir = d_is_dir(old_dentry); 1801 old_is_dir = d_is_dir(old_dentry);
1802 new_dsec = new_dir->i_security; 1802 new_dsec = new_dir->i_security;
1803 1803
@@ -1827,7 +1827,7 @@ static inline int may_rename(struct inode *old_dir,
1827 if (rc) 1827 if (rc)
1828 return rc; 1828 return rc;
1829 if (d_is_positive(new_dentry)) { 1829 if (d_is_positive(new_dentry)) {
1830 new_isec = new_dentry->d_inode->i_security; 1830 new_isec = d_backing_inode(new_dentry)->i_security;
1831 new_is_dir = d_is_dir(new_dentry); 1831 new_is_dir = d_is_dir(new_dentry);
1832 rc = avc_has_perm(sid, new_isec->sid, 1832 rc = avc_has_perm(sid, new_isec->sid,
1833 new_isec->sclass, 1833 new_isec->sclass,
@@ -1963,7 +1963,7 @@ static int selinux_binder_transfer_file(struct task_struct *from,
1963{ 1963{
1964 u32 sid = task_sid(to); 1964 u32 sid = task_sid(to);
1965 struct file_security_struct *fsec = file->f_security; 1965 struct file_security_struct *fsec = file->f_security;
1966 struct inode *inode = file->f_path.dentry->d_inode; 1966 struct inode *inode = d_backing_inode(file->f_path.dentry);
1967 struct inode_security_struct *isec = inode->i_security; 1967 struct inode_security_struct *isec = inode->i_security;
1968 struct common_audit_data ad; 1968 struct common_audit_data ad;
1969 int rc; 1969 int rc;
@@ -2627,7 +2627,7 @@ static int selinux_sb_remount(struct super_block *sb, void *data)
2627 break; 2627 break;
2628 case ROOTCONTEXT_MNT: { 2628 case ROOTCONTEXT_MNT: {
2629 struct inode_security_struct *root_isec; 2629 struct inode_security_struct *root_isec;
2630 root_isec = sb->s_root->d_inode->i_security; 2630 root_isec = d_backing_inode(sb->s_root)->i_security;
2631 2631
2632 if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid)) 2632 if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid))
2633 goto out_bad_option; 2633 goto out_bad_option;
@@ -2727,7 +2727,7 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode,
2727 struct task_security_struct *tsec; 2727 struct task_security_struct *tsec;
2728 struct inode_security_struct *dsec; 2728 struct inode_security_struct *dsec;
2729 struct superblock_security_struct *sbsec; 2729 struct superblock_security_struct *sbsec;
2730 struct inode *dir = dentry->d_parent->d_inode; 2730 struct inode *dir = d_backing_inode(dentry->d_parent);
2731 u32 newsid; 2731 u32 newsid;
2732 int rc; 2732 int rc;
2733 2733
@@ -2982,7 +2982,7 @@ static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name)
2982static int selinux_inode_setxattr(struct dentry *dentry, const char *name, 2982static int selinux_inode_setxattr(struct dentry *dentry, const char *name,
2983 const void *value, size_t size, int flags) 2983 const void *value, size_t size, int flags)
2984{ 2984{
2985 struct inode *inode = dentry->d_inode; 2985 struct inode *inode = d_backing_inode(dentry);
2986 struct inode_security_struct *isec = inode->i_security; 2986 struct inode_security_struct *isec = inode->i_security;
2987 struct superblock_security_struct *sbsec; 2987 struct superblock_security_struct *sbsec;
2988 struct common_audit_data ad; 2988 struct common_audit_data ad;
@@ -3059,7 +3059,7 @@ static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name,
3059 const void *value, size_t size, 3059 const void *value, size_t size,
3060 int flags) 3060 int flags)
3061{ 3061{
3062 struct inode *inode = dentry->d_inode; 3062 struct inode *inode = d_backing_inode(dentry);
3063 struct inode_security_struct *isec = inode->i_security; 3063 struct inode_security_struct *isec = inode->i_security;
3064 u32 newsid; 3064 u32 newsid;
3065 int rc; 3065 int rc;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 5fde34326dcf..d2787cca1fcb 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1737,7 +1737,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name,
1737 inc_nlink(inode); 1737 inc_nlink(inode);
1738 d_add(dentry, inode); 1738 d_add(dentry, inode);
1739 /* bump link count on parent directory, too */ 1739 /* bump link count on parent directory, too */
1740 inc_nlink(dir->d_inode); 1740 inc_nlink(d_inode(dir));
1741 1741
1742 return dentry; 1742 return dentry;
1743} 1743}