summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorzhanghailiang2014-08-18 09:42:50 +0200
committerKevin Wolf2014-08-20 11:57:05 +0200
commit1bdb176ac5add5dc9d54a230da7511b66851f1e7 (patch)
tree6d29a82d88ccac9aaa66ae1bc3aedfaa79a2e4b0 /hw
parentvirtio-blk: allow block_resize with dataplane (diff)
downloadqemu-1bdb176ac5add5dc9d54a230da7511b66851f1e7.tar.gz
qemu-1bdb176ac5add5dc9d54a230da7511b66851f1e7.tar.xz
qemu-1bdb176ac5add5dc9d54a230da7511b66851f1e7.zip
virtio-blk: fix reference a pointer which might be freed
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/virtio-blk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 302c39e2be..d9167ce9a3 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -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);