diff options
-rw-r--r-- | security/tomoyo/realpath.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 5f2e33263371..0b55faab3b32 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -108,6 +108,15 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, | |||
108 | spin_unlock(&dcache_lock); | 108 | spin_unlock(&dcache_lock); |
109 | path_put(&root); | 109 | path_put(&root); |
110 | path_put(&ns_root); | 110 | path_put(&ns_root); |
111 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ | ||
112 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && | ||
113 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { | ||
114 | sp -= 5; | ||
115 | if (sp >= newname) | ||
116 | memcpy(sp, "/proc", 5); | ||
117 | else | ||
118 | sp = ERR_PTR(-ENOMEM); | ||
119 | } | ||
111 | } | 120 | } |
112 | if (IS_ERR(sp)) | 121 | if (IS_ERR(sp)) |
113 | error = PTR_ERR(sp); | 122 | error = PTR_ERR(sp); |