]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio-blk: fix reference a pointer which might be freed
authorzhanghailiang <zhang.zhanghailiang@huawei.com>
Mon, 18 Aug 2014 07:42:50 +0000 (15:42 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 8 Sep 2014 16:23:04 +0000 (11:23 -0500)
In function virtio_blk_handle_request, it may freed memory pointed by req,
So do not access member of req after calling this function.

Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1bdb176ac5add5dc9d54a230da7511b66851f1e7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/block/virtio-blk.c

index c241c5002b56c311a670db8352a3c1bec36b8e9e..0e3925b6294f6eef021a0f493c180ae3873e64c9 100644 (file)
@@ -469,8 +469,9 @@ static void virtio_blk_dma_restart_bh(void *opaque)
     s->rq = NULL;
 
     while (req) {
+        VirtIOBlockReq *next = req->next;
         virtio_blk_handle_request(req, &mrb);
-        req = req->next;
+        req = next;
     }
 
     virtio_submit_multiwrite(s->bs, &mrb);