aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2011-12-08 07:24:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-12-08 16:18:12 -0500
commit1418a3e5ad4d01b1d4abf2c479c50b0cedd59e3f (patch)
treedaec3f125671eeb36a55ca0d00c3473af2c8872c /security
parent34a9d2c39afe74a941b9e88efe2762afc4d82443 (diff)
TOMOYO: Fix pathname handling of disconnected paths.
Current tomoyo_realpath_from_path() implementation returns strange pathname when calculating pathname of a file which belongs to lazy unmounted tree. Use local pathname rather than strange absolute pathname in that case. Also, this patch fixes a regression by commit 02125a82 "fix apparmor dereferencing potentially freed dentry, sanitize __d_path() API". Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/tomoyo/realpath.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index 36fa7c9bedc4..d9f3ced8756e 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -293,8 +293,16 @@ char *tomoyo_realpath_from_path(struct path *path)
293 pos = tomoyo_get_local_path(path->dentry, buf, 293 pos = tomoyo_get_local_path(path->dentry, buf,
294 buf_len - 1); 294 buf_len - 1);
295 /* Get absolute name for the rest. */ 295 /* Get absolute name for the rest. */
296 else 296 else {
297 pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); 297 pos = tomoyo_get_absolute_path(path, buf, buf_len - 1);
298 /*
299 * Fall back to local name if absolute name is not
300 * available.
301 */
302 if (pos == ERR_PTR(-EINVAL))
303 pos = tomoyo_get_local_path(path->dentry, buf,
304 buf_len - 1);
305 }
298encode: 306encode:
299 if (IS_ERR(pos)) 307 if (IS_ERR(pos))
300 continue; 308 continue;