proc-alloc-path_max-bytes-for-proc-pid-fd-symlinks.patch removed from -mm tree
The patch titled
Subject: proc: alloc PATH_MAX bytes for /proc/${pid}/fd/ symlinkshas been removed from the -mm tree. Its filename was
proc-alloc-path_max-bytes-for-proc-pid-fd-symlinks.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Hao Lee <[email protected]>
Subject: proc: alloc PATH_MAX bytes for /proc/${pid}/fd/ symlinks
It's not a standard approach that use __get_free_page() to alloc path buffer directly. We'd better use kmalloc and PATH_MAX.
PAGE_SIZE is different on different archs. An unlinked file with very long canonical pathname will readlink differently
because "(deleted)" eats into a buffer. --adobriyan
[[email protected]: remove now-unneeded cast]
Signed-off-by Hao Lee <[email protected]>
Signed-off-by Alexey Dobriyan <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Kees Cook <[email protected]>
Cc James Morris <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/proc/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/proc/base.c renamed from fs/proc/base.c~proc-alloc-path_max-bytes-for-proc-pid-fd-symlinks +4 -4
@@ -1764,25 +1764,25 @@ out:static int do_proc_readlink (struct path *path,char __user *buffer,int buflen) { -char *tmp = (char *)__get_free_page (GFP_KERNEL ); +char *tmp =kmalloc (PATH_MAX ,GFP_KERNEL );char *pathname;int len;if (!tmp)return -ENOMEM ; - pathname =d_path (path, tmp,PAGE_SIZE ); + pathname =d_path (path, tmp,PATH_MAX ); len =PTR_ERR (pathname);if (IS_ERR (pathname)) goto out; - len = tmp +PAGE_SIZE -1 - pathname; + len = tmp +PATH_MAX -1 - pathname;if (len > buflen) len = buflen;if (copy_to_user (buffer, pathname, len)) len = -EFAULT ; out: -free_page ((unsigned long )tmp); +kfree (tmp);return len; }
_
Patches currently in -mm which might be from [email protected] are