From patchwork Wed Apr 7 11:47:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: virtio-blk: Fix use after release in virtio_blk_handle_rw_error Date: Wed, 07 Apr 2010 01:47:47 -0000 From: Jan Kiszka X-Patchwork-Id: 49600 Message-Id: <4BBC70E3.6010609@siemens.com> To: Anthony Liguori Cc: qemu-devel , Luiz Capitulino virtio_blk_req_complete releases the request we dereference again for bdrv_mon_event. Reorder both calls to fix this. Signed-off-by: Jan Kiszka --- hw/virtio-blk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 9915840..d5e8c79 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -76,8 +76,8 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read); vm_stop(0); } else { - virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read); + virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); } return 1;