diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/smack/smack_lsm.c | 2 | ||||
-rw-r--r-- | security/tomoyo/realpath.c | 25 |
2 files changed, 6 insertions, 21 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 529c9ca65878..8dffcb7c9d81 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -387,7 +387,7 @@ static int smack_sb_umount(struct vfsmount *mnt, int flags) | |||
387 | struct smk_audit_info ad; | 387 | struct smk_audit_info ad; |
388 | 388 | ||
389 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); | 389 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); |
390 | smk_ad_setfield_u_fs_path_dentry(&ad, mnt->mnt_mountpoint); | 390 | smk_ad_setfield_u_fs_path_dentry(&ad, mnt->mnt_root); |
391 | smk_ad_setfield_u_fs_path_mnt(&ad, mnt); | 391 | smk_ad_setfield_u_fs_path_mnt(&ad, mnt); |
392 | 392 | ||
393 | sbp = mnt->mnt_sb->s_security; | 393 | sbp = mnt->mnt_sb->s_security; |
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 18369d497eb8..455bc391b76d 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -89,29 +89,14 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, | |||
89 | sp = dentry->d_op->d_dname(dentry, newname + offset, | 89 | sp = dentry->d_op->d_dname(dentry, newname + offset, |
90 | newname_len - offset); | 90 | newname_len - offset); |
91 | } else { | 91 | } else { |
92 | /* Taken from d_namespace_path(). */ | 92 | struct path ns_root = {.mnt = NULL, .dentry = NULL}; |
93 | struct path root; | 93 | |
94 | struct path ns_root = { }; | ||
95 | struct path tmp; | ||
96 | |||
97 | read_lock(¤t->fs->lock); | ||
98 | root = current->fs->root; | ||
99 | path_get(&root); | ||
100 | read_unlock(¤t->fs->lock); | ||
101 | spin_lock(&vfsmount_lock); | ||
102 | if (root.mnt && root.mnt->mnt_ns) | ||
103 | ns_root.mnt = mntget(root.mnt->mnt_ns->root); | ||
104 | if (ns_root.mnt) | ||
105 | ns_root.dentry = dget(ns_root.mnt->mnt_root); | ||
106 | spin_unlock(&vfsmount_lock); | ||
107 | spin_lock(&dcache_lock); | 94 | spin_lock(&dcache_lock); |
108 | tmp = ns_root; | 95 | /* go to whatever namespace root we are under */ |
109 | sp = __d_path(path, &tmp, newname, newname_len); | 96 | sp = __d_path(path, &ns_root, newname, newname_len); |
110 | spin_unlock(&dcache_lock); | 97 | spin_unlock(&dcache_lock); |
111 | path_put(&root); | ||
112 | path_put(&ns_root); | ||
113 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ | 98 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ |
114 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && | 99 | if (!IS_ERR(sp) && (path->mnt->mnt_flags & MNT_INTERNAL) && |
115 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { | 100 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { |
116 | sp -= 5; | 101 | sp -= 5; |
117 | if (sp >= newname) | 102 | if (sp >= newname) |