2006-01-21 01:25:10

by Latchesar Ionkov

[permalink] [raw]
Subject: [PATCH] v9fs: symlink support fixes

two symlink fixes, v9fs_readlink didn't copy the last character of the
symlink name, v9fs_vfs_follow_link incorrectly called strlen of newly
allocated buffer instead of PATH_MAX.

Signed-off-by: Latchesar Ionkov <[email protected]>

---
commit 80543589e5ab35e0fda3e97f93108f136eb4e623
tree 78150d708f7d815a3aa64967741f1aa9df60be9f
parent 3ee68c4af3fd7228c1be63254b9f884614f9ebb2
author Latchesar Ionkov <[email protected]> Fri, 20 Jan 2006 20:20:38 -0500
committer Latchesar Ionkov <[email protected]> Fri, 20 Jan 2006 20:20:38 -0500

fs/9p/vfs_inode.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 91f5524..63e5b03 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -886,8 +886,8 @@ static int v9fs_readlink(struct dentry *
}

/* copy extension buffer into buffer */
- if (fcall->params.rstat.stat.extension.len < buflen)
- buflen = fcall->params.rstat.stat.extension.len;
+ if (fcall->params.rstat.stat.extension.len+1 < buflen)
+ buflen = fcall->params.rstat.stat.extension.len + 1;

memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
buffer[buflen-1] = 0;
@@ -951,7 +951,7 @@ static void *v9fs_vfs_follow_link(struct
if (!link)
link = ERR_PTR(-ENOMEM);
else {
- len = v9fs_readlink(dentry, link, strlen(link));
+ len = v9fs_readlink(dentry, link, PATH_MAX);

if (len < 0) {
__putname(link);