summaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-03-06 05:44:16 +0100
committerEric Van Hensbergen <ericvh@gmail.com>2010-03-13 15:57:29 +0100
commitfae4528b2341f2ab0c86c191e24d9cdd93624c60 (patch)
treec60df63625d95dfa7c35fc60a671a1aff0c3e938 /fs/9p
parentnet/9p: Add sysfs mount_tag file for virtio 9P device (diff)
downloadlinux-fae4528b2341f2ab0c86c191e24d9cdd93624c60.tar.xz
linux-fae4528b2341f2ab0c86c191e24d9cdd93624c60.zip
fs/9p: re-init the wstat in readdir loop
This ensure that on failure when we free the stat buf we don't end up freeing an already freed pointer in the earlier loop Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_dir.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 6580aa449541..d8a3afe4ff72 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -76,6 +76,15 @@ static inline int dt_type(struct p9_wstat *mistat)
return rettype;
}
+static void p9stat_init(struct p9_wstat *stbuf)
+{
+ stbuf->name = NULL;
+ stbuf->uid = NULL;
+ stbuf->gid = NULL;
+ stbuf->muid = NULL;
+ stbuf->extension = NULL;
+}
+
/**
* v9fs_dir_readdir - read a directory
* @filp: opened file structure
@@ -131,8 +140,8 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
rdir->head = 0;
rdir->tail = err;
}
-
while (rdir->head < rdir->tail) {
+ p9stat_init(&st);
err = p9stat_read(rdir->buf + rdir->head,
buflen - rdir->head, &st,
fid->clnt->proto_version);