Message ID | 20200729220638.344477-6-its@irrelevant.dk |
---|---|
State | New |
Headers | show |
Series | hw/block/nvme: dma handling and address mapping cleanup | expand |
On Thu, Jul 30, 2020 at 7:06 AM Klaus Jensen <its@irrelevant.dk> wrote: > > From: Klaus Jensen <k.jensen@samsung.com> > > Make sure the request iov is destroyed before reuse; fixing a memory > leak. > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Looks good to me and Thanks for splitting this up. Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
On Thu, 2020-07-30 at 00:06 +0200, Klaus Jensen wrote: > From: Klaus Jensen <k.jensen@samsung.com> > > Make sure the request iov is destroyed before reuse; fixing a memory > leak. > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com> > --- > hw/block/nvme.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/block/nvme.c b/hw/block/nvme.c > index a9d9a2912655..8f8257e06eed 100644 > --- a/hw/block/nvme.c > +++ b/hw/block/nvme.c > @@ -554,6 +554,10 @@ static void nvme_rw_cb(void *opaque, int ret) > if (req->qsg.nalloc) { > qemu_sglist_destroy(&req->qsg); > } > + if (req->iov.nalloc) { > + qemu_iovec_destroy(&req->iov); > + } > + > nvme_enqueue_req_completion(cq, req); > } > Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Best regards, Maxim Levitsky
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a9d9a2912655..8f8257e06eed 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -554,6 +554,10 @@ static void nvme_rw_cb(void *opaque, int ret) if (req->qsg.nalloc) { qemu_sglist_destroy(&req->qsg); } + if (req->iov.nalloc) { + qemu_iovec_destroy(&req->iov); + } + nvme_enqueue_req_completion(cq, req); }