[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-next v2 03/22] virtio-9p-device: Avoid freeing u
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH for-next v2 03/22] virtio-9p-device: Avoid freeing uninitialized memory |
Date: |
Thu, 1 Aug 2013 04:17:24 +0200 |
In virtio_9p_device_init() there are 6x goto out that will lead to
v9fs_path_free() attempting to free unitialized path.data field.
Easiest way to trigger is: qemu-system-x86_64 -device virtio-9p-pci
Fix this by moving v9fs_path_init() before any goto out.
Signed-off-by: Andreas Färber <address@hidden>
---
hw/9pfs/virtio-9p-device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index de6f0fe..f0ffbe8 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -61,6 +61,8 @@ static int virtio_9p_device_init(VirtIODevice *vdev)
s->vq = virtio_add_queue(vdev, MAX_REQ, handle_9p_output);
+ v9fs_path_init(&path);
+
fse = get_fsdev_fsentry(s->fsconf.fsdev_id);
if (!fse) {
@@ -111,7 +113,6 @@ static int virtio_9p_device_init(VirtIODevice *vdev)
* call back to do that. Since we are in the init path, we don't
* use co-routines here.
*/
- v9fs_path_init(&path);
if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
fprintf(stderr,
"error in converting name to path %s", strerror(errno));
--
1.8.1.4
- [Qemu-devel] [PATCH for-next v2 00/22] QOM realize for virtio, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 03/22] virtio-9p-device: Avoid freeing uninitialized memory,
Andreas Färber <=
- [Qemu-devel] [PATCH for-next v2 01/22] object: Add OBJECT_GET_PARENT_CLASS() macro, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 05/22] virtio: Allow NULL VirtioDeviceClass::init hook, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 07/22] virtio-9p: Convert to QOM realize, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 08/22] virtio-blk: QOM realize preparations, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 02/22] virtio-console: Use exitfn for virtserialport, too, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 06/22] virtio-9p: QOM realize preparations, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 04/22] virtio-blk-dataplane: Improve error reporting, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 10/22] virtio-serial: QOM realize preparations, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 09/22] virtio-blk: Convert to QOM realize, Andreas Färber, 2013/07/31
- [Qemu-devel] [PATCH for-next v2 11/22] virtio-serial: Convert to QOM realize, Andreas Färber, 2013/07/31