[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cc8cb124-86c8-fceb-a5cc-1b59c5c4a9af@amd.com>
Date: Wed, 14 Jun 2023 13:06:03 +0530
From: Vasant Hegde <vasant.hegde@....com>
To: Hao Ge <gehao@...inos.cn>, joro@...tes.org,
suravee.suthikulpanit@....com, will@...nel.org,
robin.murphy@....com
Cc: kevin.tian@...el.com, jgg@...pe.ca, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, gehao618@....com
Subject: Re: [PATCH] iommu/amd: Fix memory leak when domain type checks fail
Hi,
On 6/12/2023 7:47 AM, Hao Ge wrote:
> When domain type checks fail,we also should free protection_domain struct
> to avoid memory leak in protection_domain_alloc
>
There is another patch from Su to fix this issue [1].
[1] https://lore.kernel.org/linux-iommu/20230608021933.856045-1-suhui@nfschina.com/
-Vasant
> Fixes: 29f54745f245 ("iommu/amd: Add missing domain type checks")
> Signed-off-by: Hao Ge <gehao@...inos.cn>
> ---
> drivers/iommu/amd/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index dc1ec6849775..f08e65629c74 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2094,7 +2094,7 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
> } else if (type == IOMMU_DOMAIN_DMA || type == IOMMU_DOMAIN_DMA_FQ) {
> pgtable = amd_iommu_pgtable;
> } else {
> - return NULL;
> + goto out_err;
> }
>
> switch (pgtable) {
Powered by blists - more mailing lists