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

[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: NLatchesar Ionkov <lucho@ionkov.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8e75f744
...@@ -886,8 +886,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) ...@@ -886,8 +886,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
} }
/* copy extension buffer into buffer */ /* copy extension buffer into buffer */
if (fcall->params.rstat.stat.extension.len < buflen) if (fcall->params.rstat.stat.extension.len+1 < buflen)
buflen = fcall->params.rstat.stat.extension.len; buflen = fcall->params.rstat.stat.extension.len + 1;
memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
buffer[buflen-1] = 0; buffer[buflen-1] = 0;
...@@ -951,7 +951,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -951,7 +951,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
if (!link) if (!link)
link = ERR_PTR(-ENOMEM); link = ERR_PTR(-ENOMEM);
else { else {
len = v9fs_readlink(dentry, link, strlen(link)); len = v9fs_readlink(dentry, link, PATH_MAX);
if (len < 0) { if (len < 0) {
__putname(link); __putname(link);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册