diff options
author | Xiyu Yang <[email protected]> | 2021-06-10 10:54:29 +0800 |
---|---|---|
committer | Will Deacon <[email protected]> | 2021-06-11 11:39:01 +0100 |
commit | 1adf30f198c26539a62d761e45af72cde570413d (patch) | |
tree | 79f9f55df3f09c1a0a70bc6cac637b43d9ad4aae /lib/mpi/mpi-sub-ui.c | |
parent | 22c2d71891558170ed6d1a6bfe08caba254eafc6 (diff) |
iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails
arm_smmu_rpm_get() invokes pm_runtime_get_sync(), which increases the
refcount of the "smmu" even though the return value is less than 0.
The reference counting issue happens in some error handling paths of
arm_smmu_rpm_get() in its caller functions. When arm_smmu_rpm_get()
fails, the caller functions forget to decrease the refcount of "smmu"
increased by arm_smmu_rpm_get(), causing a refcount leak.
Fix this issue by calling pm_runtime_resume_and_get() instead of
pm_runtime_get_sync() in arm_smmu_rpm_get(), which can keep the refcount
balanced in case of failure.
Signed-off-by: Xiyu Yang <[email protected]>
Signed-off-by: Xin Tan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
Diffstat (limited to 'lib/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions