[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8610d516-b83b-3614-04a4-5ed2d4b66c56@amd.com>
Date: Wed, 7 Jun 2023 09:49:07 +0530
From: Vasant Hegde <vasant.hegde@....com>
To: Su Hui <suhui@...china.com>, Joerg Roedel <joro@...tes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>
Cc: jgg@...pe.ca, kevin.tian@...el.com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu/amd: Fix possible memory leak of 'domain'
On 6/6/2023 12:37 PM, Su Hui wrote:
> free memory of domain before return NULL.
>
> Fixes: 29f54745f245 ("iommu/amd: Add missing domain type checks")
> Signed-off-by: Su Hui <suhui@...china.com>
Reviewed-by: Vasant Hegde <vasant.hegde@....com>
-Vasant
> ---
> 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