X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=blobdiff_plain;f=security%2Ftomoyo%2Frealpath.c;h=18369d497eb80116da1d146ddc49268ae0b07229;hp=917f564cdab16bbc6daa73215ee8a39cdd559bb6;hb=1557d33007f63dd96e5d15f33af389378e5f2e54;hpb=6ec22f9b037fc0c2e00ddb7023fad279c365324d diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 917f564..18369d4 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c @@ -110,6 +110,15 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, spin_unlock(&dcache_lock); path_put(&root); path_put(&ns_root); + /* Prepend "/proc" prefix if using internal proc vfs mount. */ + if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && + (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { + sp -= 5; + if (sp >= newname) + memcpy(sp, "/proc", 5); + else + sp = ERR_PTR(-ENOMEM); + } } if (IS_ERR(sp)) error = PTR_ERR(sp);