[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 8/8] 9pfs: fix potential segfault during walk
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PULL v2 8/8] 9pfs: fix potential segfault during walk |
Date: |
Fri, 16 Sep 2016 20:03:30 +0200 |
If the call to fid_to_qid() returns an error, we will call v9fs_path_free()
on uninitialized paths.
It is a regression introduced by the following commit:
56f101ecce0e 9pfs: handle walk of ".." in the root directory
Let's fix this by initializing dpath and path before calling fid_to_qid().
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Cédric Le Goater <address@hidden>
[groug: updated the changelog to indicate this is regression and to provide
the offending commit SHA1]
Signed-off-by: Greg Kurz <address@hidden>
---
hw/9pfs/9p.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 639f93930285..119ee584969b 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1333,13 +1333,14 @@ static void v9fs_walk(void *opaque)
goto out_nofid;
}
+ v9fs_path_init(&dpath);
+ v9fs_path_init(&path);
+
err = fid_to_qid(pdu, fidp, &qid);
if (err < 0) {
goto out;
}
- v9fs_path_init(&dpath);
- v9fs_path_init(&path);
/*
* Both dpath and path initially poin to fidp.
* Needed to handle request with nwnames == 0
--
2.5.5
- [Qemu-devel] [PULL v2 0/8] 9p patches for 2.8 20160916, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 2/8] 9pfs: drop duplicate line in proxy backend, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 3/8] 9pfs: drop useless v9fs_string_null() function, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 1/8] 9pfs: drop unused fmt strings in the proxy backend, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 4/8] 9pfs: introduce v9fs_path_sprintf() helper, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 5/8] tests: virtio-9p: introduce start/stop functions, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 6/8] tests: virtio-9p: add basic configuration test, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 7/8] tests: virtio-9p: add basic transaction test, Greg Kurz, 2016/09/16
- [Qemu-devel] [PULL v2 8/8] 9pfs: fix potential segfault during walk,
Greg Kurz <=