Subject: CVE-2021-47325: iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation

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.

The Linux kernel CVE team has assigned CVE-2021-47325 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.4.134 with commit b11220803ad1
	Fixed in 5.10.52 with commit 43d1aaa1965f
	Fixed in 5.12.19 with commit 0f0c5ea09139
	Fixed in 5.13.4 with commit 5f9741a9a91f
	Fixed in 5.14 with commit 7c8f176d6a3f

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47325
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/iommu/arm/arm-smmu/arm-smmu.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b11220803ad14a2a880cc06d8e01fe2548cc85b0
	https://git.kernel.org/stable/c/43d1aaa1965f9b58035196dac49b1e1e6c9c25eb
	https://git.kernel.org/stable/c/0f0c5ea09139777d90729d408b807021f2ea6492
	https://git.kernel.org/stable/c/5f9741a9a91f25c89e04b408cd61e3ab050ce24b
	https://git.kernel.org/stable/c/7c8f176d6a3fa18aa0f8875da6f7c672ed2a8554