From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJHzo-0003be-Oq for qemu-devel@nongnu.org; Mon, 18 Aug 2014 04:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJHze-0004SF-5X for qemu-devel@nongnu.org; Mon, 18 Aug 2014 04:08:52 -0400 Sender: Paolo Bonzini Message-ID: <53F1B484.4080508@redhat.com> Date: Mon, 18 Aug 2014 10:08:36 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1408347771-10596-1-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1408347771-10596-1-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7] virtio-blk: fix reference a pointer which might be freed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mst@redhat.com, luonengjun@huawei.com, qemu-stable@nongnu.org, peter.huangpeng@huawei.com, stefanha@redhat.com Il 18/08/2014 09:42, zhanghailiang ha scritto: > In function virtio_blk_handle_request, it may freed memory pointed by req, > So do not access member of req after calling this function. > > Reviewed-by: Michael S. Tsirkin > Reviewed-by: Stefan Hajnoczi > Signed-off-by: zhanghailiang > --- > 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); > Cc: qemu-stable@nongnu.org