aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorzhanghailiang <zhang.zhanghailiang@huawei.com>2014-08-18 15:42:50 +0800
committerKevin Wolf <kwolf@redhat.com>2014-08-20 11:57:05 +0200
commit1bdb176ac5add5dc9d54a230da7511b66851f1e7 (patch)
tree6d29a82d88ccac9aaa66ae1bc3aedfaa79a2e4b0 /hw
parent466560b9fcada2656b276eb30e25da15a6e706df (diff)
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);