iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
Subsystems (2)
PATCH 1/1 iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
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 <[email protected]>
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu.c +3 -1
@@ -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; }
Signature · 1 line
2.25.1
Quoted 15 lines · Yang Yingliang
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 <[email protected]>Signed-off-by Yang Yingliang <[email protected]>--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iommu/arm/arm-smmu/arm-smmu.c +0
-0
drivers/iommu/arm/arm-smmu/arm-smmu.c static struct iommu_group *arm_smmu_device_group(struct device *dev) · line 1484
Quoted 8 lines
drivers/iommu/arm/arm-smmu/arm-smmu.c +3
-1@@ -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 <[email protected]>
Joerg -- please can you throw this on top?
Will
Joerg Roedel
maintainerQuoted 1 line · Will Deacon
Joerg -- please can you throw this on top?
Sure, now applied, thanks.