From: Gautam Dawar <gdawar@amd.com>
To: Jason Wang <jasowang@redhat.com>, mst@redhat.com
Cc: gautam.dawar@xilinx.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vdpasim: fix memory leak when freeing IOTLBs
Date: Tue, 13 Dec 2022 16:38:49 +0530 [thread overview]
Message-ID: <4cdcf6d7-8bc3-6392-2ae6-b3faf41bec62@amd.com> (raw)
In-Reply-To: <20221213090717.61529-1-jasowang@redhat.com>
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@xilinx.com>
> Signed-off-by: Jason Wang <jasowang@redhat.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@amd.com>
prev parent reply other threads:[~2022-12-13 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 9:07 Jason Wang
2022-12-13 11:08 ` Gautam Dawar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4cdcf6d7-8bc3-6392-2ae6-b3faf41bec62@amd.com \
--to=gdawar@amd.com \
--cc=gautam.dawar@xilinx.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®