diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-12-08 21:24:06 +0900 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-12-08 13:18:12 -0800 |
commit | 1418a3e5ad4d01b1d4abf2c479c50b0cedd59e3f (patch) | |
tree | daec3f125671eeb36a55ca0d00c3473af2c8872c /security | |
parent | 34a9d2c39afe74a941b9e88efe2762afc4d82443 (diff) | |
download | linux-rt-1418a3e5ad4d01b1d4abf2c479c50b0cedd59e3f.tar.gz |
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.c | 10 |
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) pos = tomoyo_get_local_path(path->dentry, buf, buf_len - 1); /* Get absolute name for the rest. */ - else + else { pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); + /* + * Fall back to local name if absolute name is not + * available. + */ + if (pos == ERR_PTR(-EINVAL)) + pos = tomoyo_get_local_path(path->dentry, buf, + buf_len - 1); + } encode: if (IS_ERR(pos)) continue; |