Patch "iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails" has been added to the 5.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails

to the 5.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-arm-smmu-fix-arm_smmu_device-refcount-leak-whe.patch
and it can be found in the queue-5.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 934ff21f5b4415e4d162435a20b4fa6908181315
Author: Xiyu Yang <xiyuyang19@xxxxxxxxxxxx>
Date:   Thu Jun 10 10:54:29 2021 +0800

    iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails
    
    [ Upstream commit 1adf30f198c26539a62d761e45af72cde570413d ]
    
    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 <xiyuyang19@xxxxxxxxxxxx>
    Signed-off-by: Xin Tan <tanxin.ctf@xxxxxxxxx>
    Link: https://lore.kernel.org/r/1623293672-17954-1-git-send-email-xiyuyang19@xxxxxxxxxxxx
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 6f72c4d208ca..ee6cac9e7c02 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -74,7 +74,7 @@ static bool using_legacy_binding, using_generic_binding;
 static inline int arm_smmu_rpm_get(struct arm_smmu_device *smmu)
 {
 	if (pm_runtime_enabled(smmu->dev))
-		return pm_runtime_get_sync(smmu->dev);
+		return pm_runtime_resume_and_get(smmu->dev);
 
 	return 0;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux