Commit 0d1335b3 authored by Nathan Scott's avatar Nathan Scott

[XFS] Fix follow_link when dealing with symlinks larger than 256 bytes.

Thanks to Yamamoto Takashi.

SGI-PV: 947953
SGI-Modid: xfs-linux-melb:xfs-kern:24962a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 3762ec6b
...@@ -546,7 +546,7 @@ linvfs_follow_link( ...@@ -546,7 +546,7 @@ linvfs_follow_link(
ASSERT(dentry); ASSERT(dentry);
ASSERT(nd); ASSERT(nd);
link = (char *)kmalloc(MAXNAMELEN+1, GFP_KERNEL); link = (char *)kmalloc(MAXPATHLEN+1, GFP_KERNEL);
if (!link) { if (!link) {
nd_set_link(nd, ERR_PTR(-ENOMEM)); nd_set_link(nd, ERR_PTR(-ENOMEM));
return NULL; return NULL;
...@@ -562,12 +562,12 @@ linvfs_follow_link( ...@@ -562,12 +562,12 @@ linvfs_follow_link(
vp = LINVFS_GET_VP(dentry->d_inode); vp = LINVFS_GET_VP(dentry->d_inode);
iov.iov_base = link; iov.iov_base = link;
iov.iov_len = MAXNAMELEN; iov.iov_len = MAXPATHLEN;
uio->uio_iov = &iov; uio->uio_iov = &iov;
uio->uio_offset = 0; uio->uio_offset = 0;
uio->uio_segflg = UIO_SYSSPACE; uio->uio_segflg = UIO_SYSSPACE;
uio->uio_resid = MAXNAMELEN; uio->uio_resid = MAXPATHLEN;
uio->uio_iovcnt = 1; uio->uio_iovcnt = 1;
VOP_READLINK(vp, uio, 0, NULL, error); VOP_READLINK(vp, uio, 0, NULL, error);
...@@ -575,7 +575,7 @@ linvfs_follow_link( ...@@ -575,7 +575,7 @@ linvfs_follow_link(
kfree(link); kfree(link);
link = ERR_PTR(-error); link = ERR_PTR(-error);
} else { } else {
link[MAXNAMELEN - uio->uio_resid] = '\0'; link[MAXPATHLEN - uio->uio_resid] = '\0';
} }
kfree(uio); kfree(uio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment