Received: from eggs.gnu.org ([2001:4830:134:3::10]:47171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSl-0003Po-7E for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:18:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4iSd-0006GI-PV for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:17:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60959 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4iSd-0006Fk-JR for qemu-devel@nongnu.org; Wed, 31 Jul 2013 22:17:51 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 1 Aug 2013 04:17:24 +0200 Message-Id: <1375323463-32747-4-git-send-email-afaerber@suse.de> In-Reply-To: <1375323463-32747-1-git-send-email-afaerber@suse.de> References: <1375323463-32747-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-next v2 03/22] virtio-9p-device: Avoid freeing uninitialized memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Aneesh Kumar K.V" 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=C3=A4rber --- 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) =20 s->vq =3D virtio_add_queue(vdev, MAX_REQ, handle_9p_output); =20 + v9fs_path_init(&path); + fse =3D get_fsdev_fsentry(s->fsconf.fsdev_id); =20 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)); --=20 1.8.1.4