[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/4] virtio-blk: fix reference a pointer which might
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH 3/4] virtio-blk: fix reference a pointer which might be freed |
Date: |
Mon, 4 Aug 2014 16:25:43 +0800 |
In function virtio_blk_handle_request, it may freed memory pointed by req,
So do not access member of req after calling this function.
Signed-off-by: zhanghailiang <address@hidden>
---
hw/block/virtio-blk.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index c241c50..54a853a 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -458,7 +458,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev,
VirtQueue *vq)
static void virtio_blk_dma_restart_bh(void *opaque)
{
VirtIOBlock *s = opaque;
- VirtIOBlockReq *req = s->rq;
+ VirtIOBlockReq *req = s->rq, *next = NULL;
MultiReqBuffer mrb = {
.num_writes = 0,
};
@@ -469,8 +469,9 @@ static void virtio_blk_dma_restart_bh(void *opaque)
s->rq = NULL;
while (req) {
+ next = req->next;
virtio_blk_handle_request(req, &mrb);
- req = req->next;
+ req = next;
}
virtio_submit_multiwrite(s->bs, &mrb);
--
1.7.12.4
- Re: [Qemu-devel] [PATCH 1/4] l2cap: fix access freed memory, (continued)
[Qemu-devel] [PATCH 2/4] monitor: fix access freed memory, zhanghailiang, 2014/08/04
[Qemu-devel] [PATCH 3/4] virtio-blk: fix reference a pointer which might be freed,
zhanghailiang <=