diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2010-03-05 23:44:16 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-03-13 09:57:29 -0500 |
commit | fae4528b2341f2ab0c86c191e24d9cdd93624c60 (patch) | |
tree | c60df63625d95dfa7c35fc60a671a1aff0c3e938 /fs | |
parent | 86c8437383acd85c05ec7c9a004f59fe7ac9821a (diff) |
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')
-rw-r--r-- | fs/9p/vfs_dir.c | 11 |
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) | |||
76 | return rettype; | 76 | return rettype; |
77 | } | 77 | } |
78 | 78 | ||
79 | static void p9stat_init(struct p9_wstat *stbuf) | ||
80 | { | ||
81 | stbuf->name = NULL; | ||
82 | stbuf->uid = NULL; | ||
83 | stbuf->gid = NULL; | ||
84 | stbuf->muid = NULL; | ||
85 | stbuf->extension = NULL; | ||
86 | } | ||
87 | |||
79 | /** | 88 | /** |
80 | * v9fs_dir_readdir - read a directory | 89 | * v9fs_dir_readdir - read a directory |
81 | * @filp: opened file structure | 90 | * @filp: opened file structure |
@@ -131,8 +140,8 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
131 | rdir->head = 0; | 140 | rdir->head = 0; |
132 | rdir->tail = err; | 141 | rdir->tail = err; |
133 | } | 142 | } |
134 | |||
135 | while (rdir->head < rdir->tail) { | 143 | while (rdir->head < rdir->tail) { |
144 | p9stat_init(&st); | ||
136 | err = p9stat_read(rdir->buf + rdir->head, | 145 | err = p9stat_read(rdir->buf + rdir->head, |
137 | buflen - rdir->head, &st, | 146 | buflen - rdir->head, &st, |
138 | fid->clnt->proto_version); | 147 | fid->clnt->proto_version); |