[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4cdcf6d7-8bc3-6392-2ae6-b3faf41bec62@amd.com>
Date: Tue, 13 Dec 2022 16:38:49 +0530
From: Gautam Dawar <gdawar@....com>
To: Jason Wang <jasowang@...hat.com>, mst@...hat.com
Cc: gautam.dawar@...inx.com, virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vdpasim: fix memory leak when freeing IOTLBs
On 12/13/22 14:37, Jason Wang wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> After commit bda324fd037a ("vdpasim: control virtqueue support"),
> vdpasim->iommu became an array of IOTLB, so we should clean the
> mappings of each free one by one instead of just deleting the ranges
> in the first IOTLB which may leak maps.
>
> Fixes: bda324fd037a ("vdpasim: control virtqueue support")
> Cc: Gautam Dawar <gautam.dawar@...inx.com>
> Signed-off-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index b071f0d842fb..9668dc477843 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -690,7 +690,9 @@ static void vdpasim_free(struct vdpa_device *vdpa)
> }
>
> kvfree(vdpasim->buffer);
> - vhost_iotlb_free(vdpasim->iommu);
> + for (i = 0; i < vdpasim->dev_attr.nas; i++)
> + vhost_iotlb_reset(&vdpasim->iommu[i]);
> + kfree(vdpasim->iommu);
> kfree(vdpasim->vqs);
> kfree(vdpasim->config);
> }
> --
> 2.25.1
>
Looks good to me.
Reviewed-by: Gautam Dawar <gautam.dawar@....com>
Powered by blists - more mailing lists