]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation
authorXiyu Yang <xiyuyang19@fudan.edu.cn>
Thu, 10 Jun 2021 02:49:20 +0000 (10:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:08 +0000 (16:02 +0200)
commit0f0c5ea09139777d90729d408b807021f2ea6492
tree0de10d62e2d873b8ed366e7da3dfe0a3b884bcc1
parentfbf4daa6f4105e01fbd3868006f65c163365c1e3
iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation

[ Upstream commit 7c8f176d6a3fa18aa0f8875da6f7c672ed2a8554 ]

The reference counting issue happens in several exception handling paths
of arm_smmu_iova_to_phys_hard(). When those error scenarios occur, the
function forgets to decrease the refcount of "smmu" increased by
arm_smmu_rpm_get(), causing a refcount leak.

Fix this issue by jumping to "out" label when those error scenarios
occur.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/1623293391-17261-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/arm/arm-smmu/arm-smmu.c