aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
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/smack
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/smack')
-rw-r--r--security/smack/smack_lsm.c46
-rw-r--r--security/smack/smackfs.c2
2 files changed, 24 insertions, 24 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 69fdc384af30..b644757886bc 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -593,7 +593,7 @@ static int smack_sb_copy_data(char *orig, char *smackopts)
593static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) 593static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data)
594{ 594{
595 struct dentry *root = sb->s_root; 595 struct dentry *root = sb->s_root;
596 struct inode *inode = root->d_inode; 596 struct inode *inode = d_backing_inode(root);
597 struct superblock_smack *sp = sb->s_security; 597 struct superblock_smack *sp = sb->s_security;
598 struct inode_smack *isp; 598 struct inode_smack *isp;
599 struct smack_known *skp; 599 struct smack_known *skp;
@@ -889,15 +889,15 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir,
889 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); 889 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
890 smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); 890 smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry);
891 891
892 isp = smk_of_inode(old_dentry->d_inode); 892 isp = smk_of_inode(d_backing_inode(old_dentry));
893 rc = smk_curacc(isp, MAY_WRITE, &ad); 893 rc = smk_curacc(isp, MAY_WRITE, &ad);
894 rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc); 894 rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_WRITE, rc);
895 895
896 if (rc == 0 && d_is_positive(new_dentry)) { 896 if (rc == 0 && d_is_positive(new_dentry)) {
897 isp = smk_of_inode(new_dentry->d_inode); 897 isp = smk_of_inode(d_backing_inode(new_dentry));
898 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); 898 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
899 rc = smk_curacc(isp, MAY_WRITE, &ad); 899 rc = smk_curacc(isp, MAY_WRITE, &ad);
900 rc = smk_bu_inode(new_dentry->d_inode, MAY_WRITE, rc); 900 rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_WRITE, rc);
901 } 901 }
902 902
903 return rc; 903 return rc;
@@ -913,7 +913,7 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir,
913 */ 913 */
914static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) 914static int smack_inode_unlink(struct inode *dir, struct dentry *dentry)
915{ 915{
916 struct inode *ip = dentry->d_inode; 916 struct inode *ip = d_backing_inode(dentry);
917 struct smk_audit_info ad; 917 struct smk_audit_info ad;
918 int rc; 918 int rc;
919 919
@@ -956,8 +956,8 @@ static int smack_inode_rmdir(struct inode *dir, struct dentry *dentry)
956 /* 956 /*
957 * You need write access to the thing you're removing 957 * You need write access to the thing you're removing
958 */ 958 */
959 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); 959 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
960 rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); 960 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
961 if (rc == 0) { 961 if (rc == 0) {
962 /* 962 /*
963 * You also need write access to the containing directory 963 * You also need write access to the containing directory
@@ -995,15 +995,15 @@ static int smack_inode_rename(struct inode *old_inode,
995 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); 995 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
996 smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); 996 smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry);
997 997
998 isp = smk_of_inode(old_dentry->d_inode); 998 isp = smk_of_inode(d_backing_inode(old_dentry));
999 rc = smk_curacc(isp, MAY_READWRITE, &ad); 999 rc = smk_curacc(isp, MAY_READWRITE, &ad);
1000 rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc); 1000 rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_READWRITE, rc);
1001 1001
1002 if (rc == 0 && d_is_positive(new_dentry)) { 1002 if (rc == 0 && d_is_positive(new_dentry)) {
1003 isp = smk_of_inode(new_dentry->d_inode); 1003 isp = smk_of_inode(d_backing_inode(new_dentry));
1004 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); 1004 smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
1005 rc = smk_curacc(isp, MAY_READWRITE, &ad); 1005 rc = smk_curacc(isp, MAY_READWRITE, &ad);
1006 rc = smk_bu_inode(new_dentry->d_inode, MAY_READWRITE, rc); 1006 rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_READWRITE, rc);
1007 } 1007 }
1008 return rc; 1008 return rc;
1009} 1009}
@@ -1060,8 +1060,8 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr)
1060 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); 1060 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
1061 smk_ad_setfield_u_fs_path_dentry(&ad, dentry); 1061 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);
1062 1062
1063 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); 1063 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
1064 rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); 1064 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
1065 return rc; 1065 return rc;
1066} 1066}
1067 1067
@@ -1075,7 +1075,7 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr)
1075static int smack_inode_getattr(const struct path *path) 1075static int smack_inode_getattr(const struct path *path)
1076{ 1076{
1077 struct smk_audit_info ad; 1077 struct smk_audit_info ad;
1078 struct inode *inode = path->dentry->d_inode; 1078 struct inode *inode = d_backing_inode(path->dentry);
1079 int rc; 1079 int rc;
1080 1080
1081 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); 1081 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
@@ -1142,8 +1142,8 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name,
1142 smk_ad_setfield_u_fs_path_dentry(&ad, dentry); 1142 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);
1143 1143
1144 if (rc == 0) { 1144 if (rc == 0) {
1145 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); 1145 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
1146 rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); 1146 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
1147 } 1147 }
1148 1148
1149 return rc; 1149 return rc;
@@ -1164,7 +1164,7 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name,
1164 const void *value, size_t size, int flags) 1164 const void *value, size_t size, int flags)
1165{ 1165{
1166 struct smack_known *skp; 1166 struct smack_known *skp;
1167 struct inode_smack *isp = dentry->d_inode->i_security; 1167 struct inode_smack *isp = d_backing_inode(dentry)->i_security;
1168 1168
1169 if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) { 1169 if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) {
1170 isp->smk_flags |= SMK_INODE_TRANSMUTE; 1170 isp->smk_flags |= SMK_INODE_TRANSMUTE;
@@ -1209,8 +1209,8 @@ static int smack_inode_getxattr(struct dentry *dentry, const char *name)
1209 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); 1209 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
1210 smk_ad_setfield_u_fs_path_dentry(&ad, dentry); 1210 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);
1211 1211
1212 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_READ, &ad); 1212 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_READ, &ad);
1213 rc = smk_bu_inode(dentry->d_inode, MAY_READ, rc); 1213 rc = smk_bu_inode(d_backing_inode(dentry), MAY_READ, rc);
1214 return rc; 1214 return rc;
1215} 1215}
1216 1216
@@ -1246,12 +1246,12 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
1246 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); 1246 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
1247 smk_ad_setfield_u_fs_path_dentry(&ad, dentry); 1247 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);
1248 1248
1249 rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); 1249 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
1250 rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); 1250 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
1251 if (rc != 0) 1251 if (rc != 0)
1252 return rc; 1252 return rc;
1253 1253
1254 isp = dentry->d_inode->i_security; 1254 isp = d_backing_inode(dentry)->i_security;
1255 /* 1255 /*
1256 * Don't do anything special for these. 1256 * Don't do anything special for these.
1257 * XATTR_NAME_SMACKIPIN 1257 * XATTR_NAME_SMACKIPIN
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 06f719ed63c9..d9682985349e 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -2490,7 +2490,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent)
2490 return rc; 2490 return rc;
2491 } 2491 }
2492 2492
2493 root_inode = sb->s_root->d_inode; 2493 root_inode = d_inode(sb->s_root);
2494 2494
2495 return 0; 2495 return 0;
2496} 2496}