From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
error27@gmail.com
Subject: Re: [PATCH] iommu/sva: Fix memory leak in iommu_sva_bind_device()
Date: Wed, 13 Dec 2023 16:43:23 +0530 [thread overview]
Message-ID: <eef82056-ef8f-4f53-a512-1a39ea9e90f3@oracle.com> (raw)
In-Reply-To: <20231213110725.2486815-1-harshit.m.mogalapalli@oracle.com>
Hi,
On 13/12/23 4:37 pm, Harshit Mogalapalli wrote:
> Free the handle when the domain allocation fails before unlocking and
> returning.
>
Please ignore this patch, I have missed CCing correct list and few
maintainers, will resend it correctly.
Thanks,
Harshit
> Fixes: 092edaddb660 ("iommu: Support mm PASID 1:n with sva domains")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
> drivers/iommu/iommu-sva.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
> index 5175e8d85247..c3fc9201d0be 100644
> --- a/drivers/iommu/iommu-sva.c
> +++ b/drivers/iommu/iommu-sva.c
> @@ -101,7 +101,7 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm
> domain = iommu_sva_domain_alloc(dev, mm);
> if (!domain) {
> ret = -ENOMEM;
> - goto out_unlock;
> + goto out_free_handle;
> }
>
> ret = iommu_attach_device_pasid(domain, dev, iommu_mm->pasid);
> @@ -118,6 +118,7 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm
>
> out_free_domain:
> iommu_domain_free(domain);
> +out_free_handle:
> kfree(handle);
> out_unlock:
> mutex_unlock(&iommu_sva_lock);
next prev parent reply other threads:[~2023-12-13 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 11:07 [PATCH] iommu/sva: Fix memory leak in iommu_sva_bind_device() Harshit Mogalapalli
2023-12-13 11:13 ` Harshit Mogalapalli [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-12-13 11:14 Harshit Mogalapalli
2023-12-13 13:26 ` Baolu Lu
2023-12-15 8:07 ` Joerg Roedel
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=eef82056-ef8f-4f53-a512-1a39ea9e90f3@oracle.com \
--to=harshit.m.mogalapalli@oracle.com \
--cc=dan.carpenter@linaro.org \
--cc=error27@gmail.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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