aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-03-17 18:26:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-15 15:06:56 -0400
commitc6f493d631c4d40cea5c36055f9148f547b200af (patch)
tree233b04dca85cd796dffe1284a55b1fba24d0d59a /security
parentc5ef60352893b139147b7c033354e8e028e7f52a (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')
-rw-r--r--security/apparmor/file.c6
-rw-r--r--security/apparmor/lsm.c18
-rw-r--r--security/commoncap.c6
-rw-r--r--security/integrity/evm/evm_crypto.c4
-rw-r--r--security/integrity/evm/evm_main.c18
-rw-r--r--security/integrity/ima/ima_appraise.c10
-rw-r--r--security/lsm_audit.c4
-rw-r--r--security/security.c50
-rw-r--r--security/selinux/hooks.c36
-rw-r--r--security/smack/smack_lsm.c46
-rw-r--r--security/tomoyo/condition.c2
-rw-r--r--security/tomoyo/realpath.c10
12 files changed, 105 insertions, 105 deletions
diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index fdaa50cb1876..913f377a038a 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -259,7 +259,7 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start,
259 */ 259 */
260static inline bool is_deleted(struct dentry *dentry) 260static inline bool is_deleted(struct dentry *dentry)
261{ 261{
262 if (d_unlinked(dentry) && dentry->d_inode->i_nlink == 0) 262 if (d_unlinked(dentry) && d_backing_inode(dentry)->i_nlink == 0)
263 return 1; 263 return 1;
264 return 0; 264 return 0;
265} 265}
@@ -351,8 +351,8 @@ int aa_path_link(struct aa_profile *profile, struct dentry *old_dentry,
351 struct path link = { new_dir->mnt, new_dentry }; 351 struct path link = { new_dir->mnt, new_dentry };
352 struct path target = { new_dir->mnt, old_dentry }; 352 struct path target = { new_dir->mnt, old_dentry };
353 struct path_cond cond = { 353 struct path_cond cond = {
354 old_dentry->d_inode->i_uid, 354 d_backing_inode(old_dentry)->i_uid,
355 old_dentry->d_inode->i_mode 355 d_backing_inode(old_dentry)->i_mode
356 }; 356 };
357 char *buffer = NULL, *buffer2 = NULL; 357 char *buffer = NULL, *buffer2 = NULL;
358 const char *lname, *tname = NULL, *info = NULL; 358 const char *lname, *tname = NULL, *info = NULL;
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index dd56bffd6500..e5f1561439db 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -204,8 +204,8 @@ static int common_perm_mnt_dentry(int op, struct vfsmount *mnt,
204 struct dentry *dentry, u32 mask) 204 struct dentry *dentry, u32 mask)
205{ 205{
206 struct path path = { mnt, dentry }; 206 struct path path = { mnt, dentry };
207 struct path_cond cond = { dentry->d_inode->i_uid, 207 struct path_cond cond = { d_backing_inode(dentry)->i_uid,
208 dentry->d_inode->i_mode 208 d_backing_inode(dentry)->i_mode
209 }; 209 };
210 210
211 return common_perm(op, &path, mask, &cond); 211 return common_perm(op, &path, mask, &cond);
@@ -223,7 +223,7 @@ static int common_perm_mnt_dentry(int op, struct vfsmount *mnt,
223static int common_perm_rm(int op, struct path *dir, 223static int common_perm_rm(int op, struct path *dir,
224 struct dentry *dentry, u32 mask) 224 struct dentry *dentry, u32 mask)
225{ 225{
226 struct inode *inode = dentry->d_inode; 226 struct inode *inode = d_backing_inode(dentry);
227 struct path_cond cond = { }; 227 struct path_cond cond = { };
228 228
229 if (!inode || !dir->mnt || !mediated_filesystem(dentry)) 229 if (!inode || !dir->mnt || !mediated_filesystem(dentry))
@@ -281,8 +281,8 @@ static int apparmor_path_mknod(struct path *dir, struct dentry *dentry,
281 281
282static int apparmor_path_truncate(struct path *path) 282static int apparmor_path_truncate(struct path *path)
283{ 283{
284 struct path_cond cond = { path->dentry->d_inode->i_uid, 284 struct path_cond cond = { d_backing_inode(path->dentry)->i_uid,
285 path->dentry->d_inode->i_mode 285 d_backing_inode(path->dentry)->i_mode
286 }; 286 };
287 287
288 if (!path->mnt || !mediated_filesystem(path->dentry)) 288 if (!path->mnt || !mediated_filesystem(path->dentry))
@@ -327,8 +327,8 @@ static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry,
327 if (!unconfined(profile)) { 327 if (!unconfined(profile)) {
328 struct path old_path = { old_dir->mnt, old_dentry }; 328 struct path old_path = { old_dir->mnt, old_dentry };
329 struct path new_path = { new_dir->mnt, new_dentry }; 329 struct path new_path = { new_dir->mnt, new_dentry };
330 struct path_cond cond = { old_dentry->d_inode->i_uid, 330 struct path_cond cond = { d_backing_inode(old_dentry)->i_uid,
331 old_dentry->d_inode->i_mode 331 d_backing_inode(old_dentry)->i_mode
332 }; 332 };
333 333
334 error = aa_path_perm(OP_RENAME_SRC, profile, &old_path, 0, 334 error = aa_path_perm(OP_RENAME_SRC, profile, &old_path, 0,
@@ -354,8 +354,8 @@ static int apparmor_path_chmod(struct path *path, umode_t mode)
354 354
355static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid) 355static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid)
356{ 356{
357 struct path_cond cond = { path->dentry->d_inode->i_uid, 357 struct path_cond cond = { d_backing_inode(path->dentry)->i_uid,
358 path->dentry->d_inode->i_mode 358 d_backing_inode(path->dentry)->i_mode
359 }; 359 };
360 360
361 if (!mediated_filesystem(path->dentry)) 361 if (!mediated_filesystem(path->dentry))
diff --git a/security/commoncap.c b/security/commoncap.c
index f66713bd7450..f2875cd9f677 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -297,7 +297,7 @@ static inline void bprm_clear_caps(struct linux_binprm *bprm)
297 */ 297 */
298int cap_inode_need_killpriv(struct dentry *dentry) 298int cap_inode_need_killpriv(struct dentry *dentry)
299{ 299{
300 struct inode *inode = dentry->d_inode; 300 struct inode *inode = d_backing_inode(dentry);
301 int error; 301 int error;
302 302
303 if (!inode->i_op->getxattr) 303 if (!inode->i_op->getxattr)
@@ -319,7 +319,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
319 */ 319 */
320int cap_inode_killpriv(struct dentry *dentry) 320int cap_inode_killpriv(struct dentry *dentry)
321{ 321{
322 struct inode *inode = dentry->d_inode; 322 struct inode *inode = d_backing_inode(dentry);
323 323
324 if (!inode->i_op->removexattr) 324 if (!inode->i_op->removexattr)
325 return 0; 325 return 0;
@@ -375,7 +375,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,
375 */ 375 */
376int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps) 376int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps)
377{ 377{
378 struct inode *inode = dentry->d_inode; 378 struct inode *inode = d_backing_inode(dentry);
379 __u32 magic_etc; 379 __u32 magic_etc;
380 unsigned tocopy, i; 380 unsigned tocopy, i;
381 int size; 381 int size;
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index 5e9687f02e1b..159ef3ea4130 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -131,7 +131,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry,
131 size_t req_xattr_value_len, 131 size_t req_xattr_value_len,
132 char type, char *digest) 132 char type, char *digest)
133{ 133{
134 struct inode *inode = dentry->d_inode; 134 struct inode *inode = d_backing_inode(dentry);
135 struct shash_desc *desc; 135 struct shash_desc *desc;
136 char **xattrname; 136 char **xattrname;
137 size_t xattr_size = 0; 137 size_t xattr_size = 0;
@@ -199,7 +199,7 @@ int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
199int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, 199int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
200 const char *xattr_value, size_t xattr_value_len) 200 const char *xattr_value, size_t xattr_value_len)
201{ 201{
202 struct inode *inode = dentry->d_inode; 202 struct inode *inode = d_backing_inode(dentry);
203 struct evm_ima_xattr_data xattr_data; 203 struct evm_ima_xattr_data xattr_data;
204 int rc = 0; 204 int rc = 0;
205 205
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c
index f589c9a05da2..10f994307a04 100644
--- a/security/integrity/evm/evm_main.c
+++ b/security/integrity/evm/evm_main.c
@@ -72,7 +72,7 @@ static void __init evm_init_config(void)
72 72
73static int evm_find_protected_xattrs(struct dentry *dentry) 73static int evm_find_protected_xattrs(struct dentry *dentry)
74{ 74{
75 struct inode *inode = dentry->d_inode; 75 struct inode *inode = d_backing_inode(dentry);
76 char **xattr; 76 char **xattr;
77 int error; 77 int error;
78 int count = 0; 78 int count = 0;
@@ -165,8 +165,8 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
165 /* Replace RSA with HMAC if not mounted readonly and 165 /* Replace RSA with HMAC if not mounted readonly and
166 * not immutable 166 * not immutable
167 */ 167 */
168 if (!IS_RDONLY(dentry->d_inode) && 168 if (!IS_RDONLY(d_backing_inode(dentry)) &&
169 !IS_IMMUTABLE(dentry->d_inode)) 169 !IS_IMMUTABLE(d_backing_inode(dentry)))
170 evm_update_evmxattr(dentry, xattr_name, 170 evm_update_evmxattr(dentry, xattr_name,
171 xattr_value, 171 xattr_value,
172 xattr_value_len); 172 xattr_value_len);
@@ -235,7 +235,7 @@ enum integrity_status evm_verifyxattr(struct dentry *dentry,
235 return INTEGRITY_UNKNOWN; 235 return INTEGRITY_UNKNOWN;
236 236
237 if (!iint) { 237 if (!iint) {
238 iint = integrity_iint_find(dentry->d_inode); 238 iint = integrity_iint_find(d_backing_inode(dentry));
239 if (!iint) 239 if (!iint)
240 return INTEGRITY_UNKNOWN; 240 return INTEGRITY_UNKNOWN;
241 } 241 }
@@ -253,7 +253,7 @@ EXPORT_SYMBOL_GPL(evm_verifyxattr);
253 */ 253 */
254static enum integrity_status evm_verify_current_integrity(struct dentry *dentry) 254static enum integrity_status evm_verify_current_integrity(struct dentry *dentry)
255{ 255{
256 struct inode *inode = dentry->d_inode; 256 struct inode *inode = d_backing_inode(dentry);
257 257
258 if (!evm_initialized || !S_ISREG(inode->i_mode) || evm_fixmode) 258 if (!evm_initialized || !S_ISREG(inode->i_mode) || evm_fixmode)
259 return 0; 259 return 0;
@@ -293,13 +293,13 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name,
293 if (evm_status == INTEGRITY_NOXATTRS) { 293 if (evm_status == INTEGRITY_NOXATTRS) {
294 struct integrity_iint_cache *iint; 294 struct integrity_iint_cache *iint;
295 295
296 iint = integrity_iint_find(dentry->d_inode); 296 iint = integrity_iint_find(d_backing_inode(dentry));
297 if (iint && (iint->flags & IMA_NEW_FILE)) 297 if (iint && (iint->flags & IMA_NEW_FILE))
298 return 0; 298 return 0;
299 } 299 }
300out: 300out:
301 if (evm_status != INTEGRITY_PASS) 301 if (evm_status != INTEGRITY_PASS)
302 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, 302 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry),
303 dentry->d_name.name, "appraise_metadata", 303 dentry->d_name.name, "appraise_metadata",
304 integrity_status_msg[evm_status], 304 integrity_status_msg[evm_status],
305 -EPERM, 0); 305 -EPERM, 0);
@@ -379,7 +379,7 @@ void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name,
379 */ 379 */
380void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) 380void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name)
381{ 381{
382 struct inode *inode = dentry->d_inode; 382 struct inode *inode = d_backing_inode(dentry);
383 383
384 if (!evm_initialized || !evm_protected_xattr(xattr_name)) 384 if (!evm_initialized || !evm_protected_xattr(xattr_name))
385 return; 385 return;
@@ -404,7 +404,7 @@ int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
404 if ((evm_status == INTEGRITY_PASS) || 404 if ((evm_status == INTEGRITY_PASS) ||
405 (evm_status == INTEGRITY_NOXATTRS)) 405 (evm_status == INTEGRITY_NOXATTRS))
406 return 0; 406 return 0;
407 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, 407 integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry),
408 dentry->d_name.name, "appraise_metadata", 408 dentry->d_name.name, "appraise_metadata",
409 integrity_status_msg[evm_status], -EPERM, 0); 409 integrity_status_msg[evm_status], -EPERM, 0);
410 return -EPERM; 410 return -EPERM;
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index fffcdb0b31f0..4df493e4b3c9 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -165,7 +165,7 @@ void ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, int xattr_len,
165int ima_read_xattr(struct dentry *dentry, 165int ima_read_xattr(struct dentry *dentry,
166 struct evm_ima_xattr_data **xattr_value) 166 struct evm_ima_xattr_data **xattr_value)
167{ 167{
168 struct inode *inode = dentry->d_inode; 168 struct inode *inode = d_backing_inode(dentry);
169 169
170 if (!inode->i_op->getxattr) 170 if (!inode->i_op->getxattr)
171 return 0; 171 return 0;
@@ -190,7 +190,7 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint,
190 static const char op[] = "appraise_data"; 190 static const char op[] = "appraise_data";
191 char *cause = "unknown"; 191 char *cause = "unknown";
192 struct dentry *dentry = file->f_path.dentry; 192 struct dentry *dentry = file->f_path.dentry;
193 struct inode *inode = dentry->d_inode; 193 struct inode *inode = d_backing_inode(dentry);
194 enum integrity_status status = INTEGRITY_UNKNOWN; 194 enum integrity_status status = INTEGRITY_UNKNOWN;
195 int rc = xattr_len, hash_start = 0; 195 int rc = xattr_len, hash_start = 0;
196 196
@@ -314,7 +314,7 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
314 */ 314 */
315void ima_inode_post_setattr(struct dentry *dentry) 315void ima_inode_post_setattr(struct dentry *dentry)
316{ 316{
317 struct inode *inode = dentry->d_inode; 317 struct inode *inode = d_backing_inode(dentry);
318 struct integrity_iint_cache *iint; 318 struct integrity_iint_cache *iint;
319 int must_appraise, rc; 319 int must_appraise, rc;
320 320
@@ -380,7 +380,7 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
380 if (result == 1) { 380 if (result == 1) {
381 if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) 381 if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST))
382 return -EINVAL; 382 return -EINVAL;
383 ima_reset_appraise_flags(dentry->d_inode, 383 ima_reset_appraise_flags(d_backing_inode(dentry),
384 (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); 384 (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0);
385 result = 0; 385 result = 0;
386 } 386 }
@@ -393,7 +393,7 @@ int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name)
393 393
394 result = ima_protect_xattr(dentry, xattr_name, NULL, 0); 394 result = ima_protect_xattr(dentry, xattr_name, NULL, 0);
395 if (result == 1) { 395 if (result == 1) {
396 ima_reset_appraise_flags(dentry->d_inode, 0); 396 ima_reset_appraise_flags(d_backing_inode(dentry), 0);
397 result = 0; 397 result = 0;
398 } 398 }
399 return result; 399 return result;
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 69fdf3bc765b..3b27e9928238 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -237,7 +237,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
237 237
238 audit_log_d_path(ab, " path=", &a->u.path); 238 audit_log_d_path(ab, " path=", &a->u.path);
239 239
240 inode = a->u.path.dentry->d_inode; 240 inode = d_backing_inode(a->u.path.dentry);
241 if (inode) { 241 if (inode) {
242 audit_log_format(ab, " dev="); 242 audit_log_format(ab, " dev=");
243 audit_log_untrustedstring(ab, inode->i_sb->s_id); 243 audit_log_untrustedstring(ab, inode->i_sb->s_id);
@@ -251,7 +251,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
251 audit_log_format(ab, " name="); 251 audit_log_format(ab, " name=");
252 audit_log_untrustedstring(ab, a->u.dentry->d_name.name); 252 audit_log_untrustedstring(ab, a->u.dentry->d_name.name);
253 253
254 inode = a->u.dentry->d_inode; 254 inode = d_backing_inode(a->u.dentry);
255 if (inode) { 255 if (inode) {
256 audit_log_format(ab, " dev="); 256 audit_log_format(ab, " dev=");
257 audit_log_untrustedstring(ab, inode->i_sb->s_id); 257 audit_log_untrustedstring(ab, inode->i_sb->s_id);
diff --git a/security/security.c b/security/security.c
index 730ac65a5737..8e9b1f4b9b45 100644
--- a/security/security.c
+++ b/security/security.c
@@ -410,7 +410,7 @@ EXPORT_SYMBOL(security_old_inode_init_security);
410int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, 410int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
411 unsigned int dev) 411 unsigned int dev)
412{ 412{
413 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 413 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
414 return 0; 414 return 0;
415 return security_ops->path_mknod(dir, dentry, mode, dev); 415 return security_ops->path_mknod(dir, dentry, mode, dev);
416} 416}
@@ -418,7 +418,7 @@ EXPORT_SYMBOL(security_path_mknod);
418 418
419int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) 419int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)
420{ 420{
421 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 421 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
422 return 0; 422 return 0;
423 return security_ops->path_mkdir(dir, dentry, mode); 423 return security_ops->path_mkdir(dir, dentry, mode);
424} 424}
@@ -426,14 +426,14 @@ EXPORT_SYMBOL(security_path_mkdir);
426 426
427int security_path_rmdir(struct path *dir, struct dentry *dentry) 427int security_path_rmdir(struct path *dir, struct dentry *dentry)
428{ 428{
429 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 429 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
430 return 0; 430 return 0;
431 return security_ops->path_rmdir(dir, dentry); 431 return security_ops->path_rmdir(dir, dentry);
432} 432}
433 433
434int security_path_unlink(struct path *dir, struct dentry *dentry) 434int security_path_unlink(struct path *dir, struct dentry *dentry)
435{ 435{
436 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 436 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
437 return 0; 437 return 0;
438 return security_ops->path_unlink(dir, dentry); 438 return security_ops->path_unlink(dir, dentry);
439} 439}
@@ -442,7 +442,7 @@ EXPORT_SYMBOL(security_path_unlink);
442int security_path_symlink(struct path *dir, struct dentry *dentry, 442int security_path_symlink(struct path *dir, struct dentry *dentry,
443 const char *old_name) 443 const char *old_name)
444{ 444{
445 if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) 445 if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry))))
446 return 0; 446 return 0;
447 return security_ops->path_symlink(dir, dentry, old_name); 447 return security_ops->path_symlink(dir, dentry, old_name);
448} 448}
@@ -450,7 +450,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
450int security_path_link(struct dentry *old_dentry, struct path *new_dir, 450int security_path_link(struct dentry *old_dentry, struct path *new_dir,
451 struct dentry *new_dentry) 451 struct dentry *new_dentry)
452{ 452{
453 if (unlikely(IS_PRIVATE(old_dentry->d_inode))) 453 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
454 return 0; 454 return 0;
455 return security_ops->path_link(old_dentry, new_dir, new_dentry); 455 return security_ops->path_link(old_dentry, new_dir, new_dentry);
456} 456}
@@ -459,8 +459,8 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
459 struct path *new_dir, struct dentry *new_dentry, 459 struct path *new_dir, struct dentry *new_dentry,
460 unsigned int flags) 460 unsigned int flags)
461{ 461{
462 if (unlikely(IS_PRIVATE(old_dentry->d_inode) || 462 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) ||
463 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) 463 (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry)))))
464 return 0; 464 return 0;
465 465
466 if (flags & RENAME_EXCHANGE) { 466 if (flags & RENAME_EXCHANGE) {
@@ -477,21 +477,21 @@ EXPORT_SYMBOL(security_path_rename);
477 477
478int security_path_truncate(struct path *path) 478int security_path_truncate(struct path *path)
479{ 479{
480 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 480 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
481 return 0; 481 return 0;
482 return security_ops->path_truncate(path); 482 return security_ops->path_truncate(path);
483} 483}
484 484
485int security_path_chmod(struct path *path, umode_t mode) 485int security_path_chmod(struct path *path, umode_t mode)
486{ 486{
487 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 487 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
488 return 0; 488 return 0;
489 return security_ops->path_chmod(path, mode); 489 return security_ops->path_chmod(path, mode);
490} 490}
491 491
492int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) 492int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
493{ 493{
494 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 494 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
495 return 0; 495 return 0;
496 return security_ops->path_chown(path, uid, gid); 496 return security_ops->path_chown(path, uid, gid);
497} 497}
@@ -513,14 +513,14 @@ EXPORT_SYMBOL_GPL(security_inode_create);
513int security_inode_link(struct dentry *old_dentry, struct inode *dir, 513int security_inode_link(struct dentry *old_dentry, struct inode *dir,
514 struct dentry *new_dentry) 514 struct dentry *new_dentry)
515{ 515{
516 if (unlikely(IS_PRIVATE(old_dentry->d_inode))) 516 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry))))
517 return 0; 517 return 0;
518 return security_ops->inode_link(old_dentry, dir, new_dentry); 518 return security_ops->inode_link(old_dentry, dir, new_dentry);
519} 519}
520 520
521int security_inode_unlink(struct inode *dir, struct dentry *dentry) 521int security_inode_unlink(struct inode *dir, struct dentry *dentry)
522{ 522{
523 if (unlikely(IS_PRIVATE(dentry->d_inode))) 523 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
524 return 0; 524 return 0;
525 return security_ops->inode_unlink(dir, dentry); 525 return security_ops->inode_unlink(dir, dentry);
526} 526}
@@ -543,7 +543,7 @@ EXPORT_SYMBOL_GPL(security_inode_mkdir);
543 543
544int security_inode_rmdir(struct inode *dir, struct dentry *dentry) 544int security_inode_rmdir(struct inode *dir, struct dentry *dentry)
545{ 545{
546 if (unlikely(IS_PRIVATE(dentry->d_inode))) 546 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
547 return 0; 547 return 0;
548 return security_ops->inode_rmdir(dir, dentry); 548 return security_ops->inode_rmdir(dir, dentry);
549} 549}
@@ -559,8 +559,8 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
559 struct inode *new_dir, struct dentry *new_dentry, 559 struct inode *new_dir, struct dentry *new_dentry,
560 unsigned int flags) 560 unsigned int flags)
561{ 561{
562 if (unlikely(IS_PRIVATE(old_dentry->d_inode) || 562 if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) ||
563 (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) 563 (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry)))))
564 return 0; 564 return 0;
565 565
566 if (flags & RENAME_EXCHANGE) { 566 if (flags & RENAME_EXCHANGE) {
@@ -576,14 +576,14 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
576 576
577int security_inode_readlink(struct dentry *dentry) 577int security_inode_readlink(struct dentry *dentry)
578{ 578{
579 if (unlikely(IS_PRIVATE(dentry->d_inode))) 579 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
580 return 0; 580 return 0;
581 return security_ops->inode_readlink(dentry); 581 return security_ops->inode_readlink(dentry);
582} 582}
583 583
584int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) 584int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
585{ 585{
586 if (unlikely(IS_PRIVATE(dentry->d_inode))) 586 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
587 return 0; 587 return 0;
588 return security_ops->inode_follow_link(dentry, nd); 588 return security_ops->inode_follow_link(dentry, nd);
589} 589}
@@ -599,7 +599,7 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
599{ 599{
600 int ret; 600 int ret;
601 601
602 if (unlikely(IS_PRIVATE(dentry->d_inode))) 602 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
603 return 0; 603 return 0;
604 ret = security_ops->inode_setattr(dentry, attr); 604 ret = security_ops->inode_setattr(dentry, attr);
605 if (ret) 605 if (ret)
@@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(security_inode_setattr);
610 610
611int security_inode_getattr(const struct path *path) 611int security_inode_getattr(const struct path *path)
612{ 612{
613 if (unlikely(IS_PRIVATE(path->dentry->d_inode))) 613 if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry))))
614 return 0; 614 return 0;
615 return security_ops->inode_getattr(path); 615 return security_ops->inode_getattr(path);
616} 616}
@@ -620,7 +620,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name,
620{ 620{
621 int ret; 621 int ret;
622 622
623 if (unlikely(IS_PRIVATE(dentry->d_inode))) 623 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
624 return 0; 624 return 0;
625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags); 625 ret = security_ops->inode_setxattr(dentry, name, value, size, flags);
626 if (ret) 626 if (ret)
@@ -634,7 +634,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name,
634void security_inode_post_setxattr(struct dentry *dentry, const char *name, 634void security_inode_post_setxattr(struct dentry *dentry, const char *name,
635 const void *value, size_t size, int flags) 635 const void *value, size_t size, int flags)
636{ 636{
637 if (unlikely(IS_PRIVATE(dentry->d_inode))) 637 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
638 return; 638 return;
639 security_ops->inode_post_setxattr(dentry, name, value, size, flags); 639 security_ops->inode_post_setxattr(dentry, name, value, size, flags);
640 evm_inode_post_setxattr(dentry, name, value, size); 640 evm_inode_post_setxattr(dentry, name, value, size);
@@ -642,14 +642,14 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name,
642 642
643int security_inode_getxattr(struct dentry *dentry, const char *name) 643int security_inode_getxattr(struct dentry *dentry, const char *name)
644{ 644{
645 if (unlikely(IS_PRIVATE(dentry->d_inode))) 645 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
646 return 0; 646 return 0;
647 return security_ops->inode_getxattr(dentry, name); 647 return security_ops->inode_getxattr(dentry, name);
648} 648}
649 649
650int security_inode_listxattr(struct dentry *dentry) 650int security_inode_listxattr(struct dentry *dentry)
651{ 651{
652 if (unlikely(IS_PRIVATE(dentry->d_inode))) 652 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
653 return 0; 653 return 0;
654 return security_ops->inode_listxattr(dentry); 654 return security_ops->inode_listxattr(dentry);
655} 655}
@@ -658,7 +658,7 @@ int security_inode_removexattr(struct dentry *dentry, const char *name)
658{ 658{
659 int ret; 659 int ret;
660 660
661 if (unlikely(IS_PRIVATE(dentry->d_inode))) 661 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
662 return 0; 662 return 0;
663 ret = security_ops->inode_removexattr(dentry, name); 663 ret = security_ops->inode_removexattr(dentry, name);
664 if (ret) 664 if (ret)
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/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)
555static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) 555static 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 */
876static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) 876static 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)
1037static int smack_inode_getattr(const struct path *path) 1037static 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
diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c
index 63681e8be628..6c4528d4b48f 100644
--- a/security/tomoyo/condition.c
+++ b/security/tomoyo/condition.c
@@ -714,7 +714,7 @@ void tomoyo_get_attributes(struct tomoyo_obj_info *obj)
714 dentry = dget_parent(dentry); 714 dentry = dget_parent(dentry);
715 break; 715 break;
716 } 716 }
717 inode = dentry->d_inode; 717 inode = d_backing_inode(dentry);
718 if (inode) { 718 if (inode) {
719 struct tomoyo_mini_stat *stat = &obj->stat[i]; 719 struct tomoyo_mini_stat *stat = &obj->stat[i];
720 stat->uid = inode->i_uid; 720 stat->uid = inode->i_uid;
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index 1e0d480ff6a6..5077f1968841 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -97,7 +97,7 @@ static char *tomoyo_get_absolute_path(const struct path *path, char * const buff
97 /* go to whatever namespace root we are under */ 97 /* go to whatever namespace root we are under */
98 pos = d_absolute_path(path, buffer, buflen - 1); 98 pos = d_absolute_path(path, buffer, buflen - 1);
99 if (!IS_ERR(pos) && *pos == '/' && pos[1]) { 99 if (!IS_ERR(pos) && *pos == '/' && pos[1]) {
100 struct inode *inode = path->dentry->d_inode; 100 struct inode *inode = d_backing_inode(path->dentry);
101 if (inode && S_ISDIR(inode->i_mode)) { 101 if (inode && S_ISDIR(inode->i_mode)) {
102 buffer[buflen - 2] = '/'; 102 buffer[buflen - 2] = '/';
103 buffer[buflen - 1] = '\0'; 103 buffer[buflen - 1] = '\0';
@@ -125,7 +125,7 @@ static char *tomoyo_get_dentry_path(struct dentry *dentry, char * const buffer,
125 if (buflen >= 256) { 125 if (buflen >= 256) {
126 pos = dentry_path_raw(dentry, buffer, buflen - 1); 126 pos = dentry_path_raw(dentry, buffer, buflen - 1);
127 if (!IS_ERR(pos) && *pos == '/' && pos[1]) { 127 if (!IS_ERR(pos) && *pos == '/' && pos[1]) {
128 struct inode *inode = dentry->d_inode; 128 struct inode *inode = d_backing_inode(dentry);
129 if (inode && S_ISDIR(inode->i_mode)) { 129 if (inode && S_ISDIR(inode->i_mode)) {
130 buffer[buflen - 2] = '/'; 130 buffer[buflen - 2] = '/';
131 buffer[buflen - 1] = '\0'; 131 buffer[buflen - 1] = '\0';
@@ -168,7 +168,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,
168 if (!MAJOR(sb->s_dev)) 168 if (!MAJOR(sb->s_dev))
169 goto prepend_filesystem_name; 169 goto prepend_filesystem_name;
170 { 170 {
171 struct inode *inode = sb->s_root->d_inode; 171 struct inode *inode = d_backing_inode(sb->s_root);
172 /* 172 /*
173 * Use filesystem name if filesystem does not support rename() 173 * Use filesystem name if filesystem does not support rename()
174 * operation. 174 * operation.
@@ -219,7 +219,7 @@ out:
219static char *tomoyo_get_socket_name(const struct path *path, char * const buffer, 219static char *tomoyo_get_socket_name(const struct path *path, char * const buffer,
220 const int buflen) 220 const int buflen)
221{ 221{
222 struct inode *inode = path->dentry->d_inode; 222 struct inode *inode = d_backing_inode(path->dentry);
223 struct socket *sock = inode ? SOCKET_I(inode) : NULL; 223 struct socket *sock = inode ? SOCKET_I(inode) : NULL;
224 struct sock *sk = sock ? sock->sk : NULL; 224 struct sock *sk = sock ? sock->sk : NULL;
225 if (sk) { 225 if (sk) {
@@ -277,7 +277,7 @@ char *tomoyo_realpath_from_path(const struct path *path)
277 pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1); 277 pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1);
278 goto encode; 278 goto encode;
279 } 279 }
280 inode = sb->s_root->d_inode; 280 inode = d_backing_inode(sb->s_root);
281 /* 281 /*
282 * Get local name for filesystems without rename() operation 282 * Get local name for filesystems without rename() operation
283 * or dentry without vfsmount. 283 * or dentry without vfsmount.