From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Joerg Roedel <jroedel@suse.de>
Cc: Will Deacon <will@kernel.org>, Joerg Roedel <joro@8bytes.org>,
linux-kernel@vger.kernel.org, Evan Green <evgreen@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
iommu@lists.linux-foundation.org, linux-arm-msm@vger.kernel.org,
Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu: Fix group refcount in iommu_alloc_default_domain()
Date: Mon, 25 May 2020 18:40:19 +0530 [thread overview]
Message-ID: <132bf1acfb685d34db9caef6f55265de@codeaurora.org> (raw)
In-Reply-To: <20200525130253.GH5075@suse.de>
Hi Joerg,
On 2020-05-25 18:32, Joerg Roedel wrote:
> 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.
>
Thanks for the patch, it looks like the right thing to do. Testing it
out now.
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
WARNING: multiple messages have this Message-ID (diff)
From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Joerg Roedel <jroedel@suse.de>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Evan Green <evgreen@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH] iommu: Fix group refcount in iommu_alloc_default_domain()
Date: Mon, 25 May 2020 18:40:19 +0530 [thread overview]
Message-ID: <132bf1acfb685d34db9caef6f55265de@codeaurora.org> (raw)
In-Reply-To: <20200525130253.GH5075@suse.de>
Hi Joerg,
On 2020-05-25 18:32, Joerg Roedel wrote:
> 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.
>
Thanks for the patch, it looks like the right thing to do. Testing it
out now.
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
To: Joerg Roedel <jroedel@suse.de>
Cc: linux-arm-msm@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
linux-kernel@vger.kernel.org, Evan Green <evgreen@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH] iommu: Fix group refcount in iommu_alloc_default_domain()
Date: Mon, 25 May 2020 18:40:19 +0530 [thread overview]
Message-ID: <132bf1acfb685d34db9caef6f55265de@codeaurora.org> (raw)
In-Reply-To: <20200525130253.GH5075@suse.de>
Hi Joerg,
On 2020-05-25 18:32, Joerg Roedel wrote:
> 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.
>
Thanks for the patch, it looks like the right thing to do. Testing it
out now.
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-05-25 13:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 13:01 [PATCH] iommu: Fix group refcount in iommu_alloc_default_domain() Sai Prakash Ranjan
2020-05-22 13:01 ` Sai Prakash Ranjan
2020-05-22 13:01 ` Sai Prakash Ranjan
2020-05-25 13:02 ` Joerg Roedel
2020-05-25 13:02 ` Joerg Roedel
2020-05-25 13:02 ` Joerg Roedel
2020-05-25 13:10 ` Sai Prakash Ranjan [this message]
2020-05-25 13:10 ` Sai Prakash Ranjan
2020-05-25 13:10 ` Sai Prakash Ranjan
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=132bf1acfb685d34db9caef6f55265de@codeaurora.org \
--to=saiprakash.ranjan@codeaurora.org \
--cc=dianders@chromium.org \
--cc=evgreen@chromium.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.