mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Hao Ge <gehao@kylinos.cn>,
	joro@8bytes.org, suravee.suthikulpanit@amd.com, will@kernel.org,
	robin.murphy@arm.com
Cc: kevin.tian@intel.com, jgg@ziepe.ca, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, gehao618@163.com
Subject: Re: [PATCH] iommu/amd: Fix memory leak when domain type checks fail
Date: Wed, 14 Jun 2023 13:06:03 +0530	[thread overview]
Message-ID: <cc8cb124-86c8-fceb-a5cc-1b59c5c4a9af@amd.com> (raw)
In-Reply-To: <20230612021718.82293-1-gehao@kylinos.cn>

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@kylinos.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) {

      reply	other threads:[~2023-06-14  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12  2:17 Hao Ge
2023-06-14  7:36 ` Vasant Hegde [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=cc8cb124-86c8-fceb-a5cc-1b59c5c4a9af@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=gehao618@163.com \
    --cc=gehao@kylinos.cn \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=will@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

all inboxes | Powered by JetHome®