[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200525130253.GH5075@suse.de>
Date: Mon, 25 May 2020 15:02:53 +0200
From: Joerg Roedel <jroedel@...e.de>
To: Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>
Cc: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Evan Green <evgreen@...omium.org>,
Douglas Anderson <dianders@...omium.org>
Subject: Re: [PATCH] iommu: Fix group refcount in iommu_alloc_default_domain()
Hi,
On Fri, May 22, 2020 at 06:31:45PM +0530, Sai Prakash Ranjan wrote:
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index a4c2f122eb8b..05f7b77c432f 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1491,6 +1491,7 @@ static int iommu_alloc_default_domain(struct device *dev)
> {
> struct iommu_group *group;
> unsigned int type;
> + int ret;
>
> group = iommu_group_get(dev);
> if (!group)
> @@ -1501,7 +1502,11 @@ static int iommu_alloc_default_domain(struct device *dev)
>
> type = iommu_get_def_domain_type(dev);
>
> - return iommu_group_alloc_default_domain(dev->bus, group, type);
> + ret = iommu_group_alloc_default_domain(dev->bus, group, type);
> +
> + iommu_group_put(group);
> +
> + return ret;
> }
>
> /**
Thanks for the report and the fix. I think it is better to fix this by
not taking a group reference in iommu_alloc_default_domain() at all and
pass group as a parameter. Please see the patch I just sent out.
Regards,
Joerg
Powered by blists - more mailing lists