]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
virtio-blk: fix use-after-free while handling scsi commands
authorAvi Kivity <avi@redhat.com>
Mon, 6 Aug 2012 12:49:03 +0000 (15:49 +0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 21 Aug 2012 20:36:35 +0000 (15:36 -0500)
The scsi passthrough handler falls through after completing a
request into the failure path, resulting in a use after free.

Reproducible by running a guest with aio=native on a block device.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 730a9c53b4e52681fcfe31cf38854cbf91e132c7)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio-blk.c

index fe0774617b54c96417790f278e4d000bf1976a3a..f44d24420dda719095a95bc0fec7577784555e4c 100644 (file)
@@ -253,6 +253,7 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
 
     virtio_blk_req_complete(req, status);
     g_free(req);
+    return;
 #else
     abort();
 #endif