LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
@ 2021-08-20 7:49 Yang Yingliang
2021-08-20 10:41 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Yang Yingliang @ 2021-08-20 7:49 UTC (permalink / raw)
To: linux-kernel; +Cc: iommu, linux-arm-kernel, will, vdumpa
Add the missing unlock before return from function arm_smmu_device_group()
in the error handling case.
Fixes: b1a1347912a7 ("iommu/arm-smmu: Fix race condition during iommu_group creation")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/iommu/arm/arm-smmu/arm-smmu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 73893180ec7e..4bc75c4ce402 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -1478,8 +1478,10 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
mutex_lock(&smmu->stream_map_mutex);
for_each_cfg_sme(cfg, fwspec, i, idx) {
if (group && smmu->s2crs[idx].group &&
- group != smmu->s2crs[idx].group)
+ group != smmu->s2crs[idx].group) {
+ mutex_unlock(&smmu->stream_map_mutex);
return ERR_PTR(-EINVAL);
+ }
group = smmu->s2crs[idx].group;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
2021-08-20 7:49 [PATCH -next] iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group() Yang Yingliang
@ 2021-08-20 10:41 ` Will Deacon
2021-08-20 12:38 ` Joerg Roedel
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2021-08-20 10:41 UTC (permalink / raw)
To: Yang Yingliang, joro; +Cc: linux-kernel, iommu, linux-arm-kernel, vdumpa
On Fri, Aug 20, 2021 at 03:49:49PM +0800, Yang Yingliang wrote:
> Add the missing unlock before return from function arm_smmu_device_group()
> in the error handling case.
>
> Fixes: b1a1347912a7 ("iommu/arm-smmu: Fix race condition during iommu_group creation")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/iommu/arm/arm-smmu/arm-smmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> index 73893180ec7e..4bc75c4ce402 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
> @@ -1478,8 +1478,10 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
> mutex_lock(&smmu->stream_map_mutex);
> for_each_cfg_sme(cfg, fwspec, i, idx) {
> if (group && smmu->s2crs[idx].group &&
> - group != smmu->s2crs[idx].group)
> + group != smmu->s2crs[idx].group) {
> + mutex_unlock(&smmu->stream_map_mutex);
> return ERR_PTR(-EINVAL);
> + }
Urgh, I should really have spotted that in review. Thanks:
Acked-by: Will Deacon <will@kernel.org>
Joerg -- please can you throw this on top?
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
2021-08-20 10:41 ` Will Deacon
@ 2021-08-20 12:38 ` Joerg Roedel
0 siblings, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2021-08-20 12:38 UTC (permalink / raw)
To: Will Deacon; +Cc: Yang Yingliang, linux-kernel, iommu, linux-arm-kernel, vdumpa
On Fri, Aug 20, 2021 at 11:41:11AM +0100, Will Deacon wrote:
> Joerg -- please can you throw this on top?
Sure, now applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-20 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 7:49 [PATCH -next] iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group() Yang Yingliang
2021-08-20 10:41 ` Will Deacon
2021-08-20 12:38 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).