diff options
| author | David Howells <dhowells@redhat.com> | 2015-03-17 18:26:22 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-15 15:06:56 -0400 |
| commit | c6f493d631c4d40cea5c36055f9148f547b200af (patch) | |
| tree | 233b04dca85cd796dffe1284a55b1fba24d0d59a /security/smack | |
| parent | c5ef60352893b139147b7c033354e8e028e7f52a (diff) | |
VFS: security/: d_backing_inode() annotations
most of the ->d_inode uses there refer to the same inode IO would
go to, i.e. d_backing_inode()
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'security/smack')
| -rw-r--r-- | security/smack/smack_lsm.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 1511965549b8..14b316f60fc5 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -555,7 +555,7 @@ static int smack_sb_copy_data(char *orig, char *smackopts) | |||
| 555 | static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) | 555 | static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) |
| 556 | { | 556 | { |
| 557 | struct dentry *root = sb->s_root; | 557 | struct dentry *root = sb->s_root; |
| 558 | struct inode *inode = root->d_inode; | 558 | struct inode *inode = d_backing_inode(root); |
| 559 | struct superblock_smack *sp = sb->s_security; | 559 | struct superblock_smack *sp = sb->s_security; |
| 560 | struct inode_smack *isp; | 560 | struct inode_smack *isp; |
| 561 | struct smack_known *skp; | 561 | struct smack_known *skp; |
| @@ -851,15 +851,15 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir, | |||
| 851 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 851 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 852 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); | 852 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); |
| 853 | 853 | ||
| 854 | isp = smk_of_inode(old_dentry->d_inode); | 854 | isp = smk_of_inode(d_backing_inode(old_dentry)); |
| 855 | rc = smk_curacc(isp, MAY_WRITE, &ad); | 855 | rc = smk_curacc(isp, MAY_WRITE, &ad); |
| 856 | rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc); | 856 | rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_WRITE, rc); |
| 857 | 857 | ||
| 858 | if (rc == 0 && d_is_positive(new_dentry)) { | 858 | if (rc == 0 && d_is_positive(new_dentry)) { |
| 859 | isp = smk_of_inode(new_dentry->d_inode); | 859 | isp = smk_of_inode(d_backing_inode(new_dentry)); |
| 860 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); | 860 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); |
| 861 | rc = smk_curacc(isp, MAY_WRITE, &ad); | 861 | rc = smk_curacc(isp, MAY_WRITE, &ad); |
| 862 | rc = smk_bu_inode(new_dentry->d_inode, MAY_WRITE, rc); | 862 | rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_WRITE, rc); |
| 863 | } | 863 | } |
| 864 | 864 | ||
| 865 | return rc; | 865 | return rc; |
| @@ -875,7 +875,7 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir, | |||
| 875 | */ | 875 | */ |
| 876 | static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) | 876 | static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) |
| 877 | { | 877 | { |
| 878 | struct inode *ip = dentry->d_inode; | 878 | struct inode *ip = d_backing_inode(dentry); |
| 879 | struct smk_audit_info ad; | 879 | struct smk_audit_info ad; |
| 880 | int rc; | 880 | int rc; |
| 881 | 881 | ||
| @@ -918,8 +918,8 @@ static int smack_inode_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 918 | /* | 918 | /* |
| 919 | * You need write access to the thing you're removing | 919 | * You need write access to the thing you're removing |
| 920 | */ | 920 | */ |
| 921 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 921 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 922 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 922 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 923 | if (rc == 0) { | 923 | if (rc == 0) { |
| 924 | /* | 924 | /* |
| 925 | * You also need write access to the containing directory | 925 | * You also need write access to the containing directory |
| @@ -957,15 +957,15 @@ static int smack_inode_rename(struct inode *old_inode, | |||
| 957 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 957 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 958 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); | 958 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); |
| 959 | 959 | ||
| 960 | isp = smk_of_inode(old_dentry->d_inode); | 960 | isp = smk_of_inode(d_backing_inode(old_dentry)); |
| 961 | rc = smk_curacc(isp, MAY_READWRITE, &ad); | 961 | rc = smk_curacc(isp, MAY_READWRITE, &ad); |
| 962 | rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc); | 962 | rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_READWRITE, rc); |
| 963 | 963 | ||
| 964 | if (rc == 0 && d_is_positive(new_dentry)) { | 964 | if (rc == 0 && d_is_positive(new_dentry)) { |
| 965 | isp = smk_of_inode(new_dentry->d_inode); | 965 | isp = smk_of_inode(d_backing_inode(new_dentry)); |
| 966 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); | 966 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); |
| 967 | rc = smk_curacc(isp, MAY_READWRITE, &ad); | 967 | rc = smk_curacc(isp, MAY_READWRITE, &ad); |
| 968 | rc = smk_bu_inode(new_dentry->d_inode, MAY_READWRITE, rc); | 968 | rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_READWRITE, rc); |
| 969 | } | 969 | } |
| 970 | return rc; | 970 | return rc; |
| 971 | } | 971 | } |
| @@ -1022,8 +1022,8 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1022 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1022 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1023 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1023 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1024 | 1024 | ||
| 1025 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1025 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1026 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1026 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1027 | return rc; | 1027 | return rc; |
| 1028 | } | 1028 | } |
| 1029 | 1029 | ||
| @@ -1037,7 +1037,7 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1037 | static int smack_inode_getattr(const struct path *path) | 1037 | static int smack_inode_getattr(const struct path *path) |
| 1038 | { | 1038 | { |
| 1039 | struct smk_audit_info ad; | 1039 | struct smk_audit_info ad; |
| 1040 | struct inode *inode = path->dentry->d_inode; | 1040 | struct inode *inode = d_backing_inode(path->dentry); |
| 1041 | int rc; | 1041 | int rc; |
| 1042 | 1042 | ||
| 1043 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); | 1043 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); |
| @@ -1104,8 +1104,8 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name, | |||
| 1104 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1104 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1105 | 1105 | ||
| 1106 | if (rc == 0) { | 1106 | if (rc == 0) { |
| 1107 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1107 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1108 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1108 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1109 | } | 1109 | } |
| 1110 | 1110 | ||
| 1111 | return rc; | 1111 | return rc; |
| @@ -1126,7 +1126,7 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name, | |||
| 1126 | const void *value, size_t size, int flags) | 1126 | const void *value, size_t size, int flags) |
| 1127 | { | 1127 | { |
| 1128 | struct smack_known *skp; | 1128 | struct smack_known *skp; |
| 1129 | struct inode_smack *isp = dentry->d_inode->i_security; | 1129 | struct inode_smack *isp = d_backing_inode(dentry)->i_security; |
| 1130 | 1130 | ||
| 1131 | if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) { | 1131 | if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) { |
| 1132 | isp->smk_flags |= SMK_INODE_TRANSMUTE; | 1132 | isp->smk_flags |= SMK_INODE_TRANSMUTE; |
| @@ -1171,8 +1171,8 @@ static int smack_inode_getxattr(struct dentry *dentry, const char *name) | |||
| 1171 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1171 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1172 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1172 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1173 | 1173 | ||
| 1174 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_READ, &ad); | 1174 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_READ, &ad); |
| 1175 | rc = smk_bu_inode(dentry->d_inode, MAY_READ, rc); | 1175 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_READ, rc); |
| 1176 | return rc; | 1176 | return rc; |
| 1177 | } | 1177 | } |
| 1178 | 1178 | ||
| @@ -1208,12 +1208,12 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) | |||
| 1208 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1208 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1209 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1209 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1210 | 1210 | ||
| 1211 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1211 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1212 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1212 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1213 | if (rc != 0) | 1213 | if (rc != 0) |
| 1214 | return rc; | 1214 | return rc; |
| 1215 | 1215 | ||
| 1216 | isp = dentry->d_inode->i_security; | 1216 | isp = d_backing_inode(dentry)->i_security; |
| 1217 | /* | 1217 | /* |
| 1218 | * Don't do anything special for these. | 1218 | * Don't do anything special for these. |
| 1219 | * XATTR_NAME_SMACKIPIN | 1219 | * XATTR_NAME_SMACKIPIN |
