提交 a1f9d8d2 编写于 作者: L Latchesar Ionkov 提交者: Linus Torvalds

[PATCH] v9fs: replace strlen on newly allocated by __getname buffers to PATH_MAX

v9fs_vfs_readlink allocates space for the link using __getname and
errorneously uses strlen on the newly allocated buffer to check if the buffer
passed by the user is bigger than the one returned by __getname.

The patch replaces the strlen usage to PATH_MAX, which is the actual size of
the buffers returned by __getname.
Signed-off-by: NLatchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a8e63bff
...@@ -1063,8 +1063,8 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer, ...@@ -1063,8 +1063,8 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer,
int ret; int ret;
char *link = __getname(); char *link = __getname();
if (strlen(link) < buflen) if (buflen > PATH_MAX)
buflen = strlen(link); buflen = PATH_MAX;
dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册