summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/realpath.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-12-18 10:35:16 +0100
committerIngo Molnar <mingo@elte.hu>2011-12-18 10:35:16 +0100
commit6e5ed276374c329b93a968d640f4d26c8c05411b (patch)
tree3b0d42269f0f52ea7764511de3a58b01d12bcb23 /security/tomoyo/realpath.c
parentd79a8869d8a4b565b12a88faeff834b09a36368c (diff)
parent384703b8e6cd4c8ef08512e596024e028c91c339 (diff)
downloadop-kernel-dev-6e5ed276374c329b93a968d640f4d26c8c05411b.zip
op-kernel-dev-6e5ed276374c329b93a968d640f4d26c8c05411b.tar.gz
Merge commit 'v3.2-rc6' into x86/platform
Diffstat (limited to 'security/tomoyo/realpath.c')
-rw-r--r--security/tomoyo/realpath.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index 738bbdf..d9f3ced 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -101,9 +101,8 @@ static char *tomoyo_get_absolute_path(struct path *path, char * const buffer,
{
char *pos = ERR_PTR(-ENOMEM);
if (buflen >= 256) {
- struct path ns_root = { };
/* go to whatever namespace root we are under */
- pos = __d_path(path, &ns_root, buffer, buflen - 1);
+ pos = d_absolute_path(path, buffer, buflen - 1);
if (!IS_ERR(pos) && *pos == '/' && pos[1]) {
struct inode *inode = path->dentry->d_inode;
if (inode && S_ISDIR(inode->i_mode)) {
@@ -294,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;
OpenPOWER on IntegriCloud