fix apparmor dereferencing potentially freed dentry, sanitize __d_path() API
[linux-2.6-block.git] / security / tomoyo / realpath.c
index 738bbdf8d4c77ceba3ba3abfe733a90dc56cd4fb..36fa7c9bedc40b4ce8f4d7db9e03f7438802078d 100644 (file)
@@ -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)) {