Skip to content

Commit

Permalink
iommu/arm-smmu: Fix missing unlock on error in arm_smmu_device_group()
Browse files Browse the repository at this point in the history
Add the missing unlock before return from function arm_smmu_device_group()
in the error handling case.

Fixes: b1a1347 ("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>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210820074949.1946576-1-yangyingliang@huawei.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Yang Yingliang authored and Joerg Roedel committed Aug 20, 2021
1 parent af1d321 commit 53f6131
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iommu/arm/arm-smmu/arm-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,8 +1488,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;
}
Expand Down

0 comments on commit 53f6131

Please sign in to comment.