From: zhanghailiang <zhang.zhanghaili...@huawei.com> 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-sta...@nongnu.org Reviewed-by: Michael S. Tsirkin <m...@redhat.com> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> Signed-off-by: Kevin Wolf <kw...@redhat.com> (cherry picked from commit 1bdb176ac5add5dc9d54a230da7511b66851f1e7) Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- hw/block/virtio-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index c241c50..0e3925b 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); -- 1.9.1