mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
arm-smmu: Fix iommu group refcount leak
If a client defines the qcom,iommu-group property, and the iommu group does not yet exist, of_get_device_group will create a new group with a refcount of one. The following call to iommu_group_ref_get() increments the refcount unnecessarily and causes a resource leak. If a client defines the qcom,iommu-group property, and the iommu group already exists, modify __bus_lookup_iommu_group() to return with an additional refcount. Change-Id: I5c9e62e50737ee4128a591ea2b14a0d47a1be162 Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
This commit is contained in:
parent
cb6f97e574
commit
b6ac46db74
1 changed files with 4 additions and 1 deletions
|
|
@ -3023,7 +3023,6 @@ static int __bus_lookup_iommu_group(struct device *dev, void *priv)
|
|||
}
|
||||
|
||||
data->group = group;
|
||||
iommu_group_put(group);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -3703,6 +3702,9 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
|
|||
int i, idx;
|
||||
|
||||
group = of_get_device_group(dev);
|
||||
if (group)
|
||||
goto finish;
|
||||
|
||||
for_each_cfg_sme(fwspec, i, idx) {
|
||||
if (group && smmu->s2crs[idx].group &&
|
||||
group != smmu->s2crs[idx].group) {
|
||||
|
|
@ -3729,6 +3731,7 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
finish:
|
||||
if (smmu->impl && smmu->impl->device_group &&
|
||||
smmu->impl->device_group(dev, group)) {
|
||||
iommu_group_put(group);
|
||||
|
|
|
|||
Loading…
Reference in a new issue