Subject: CVE-2024-42277: iommu: sprd: Avoid NULL deref in sprd_iommu_hw_en

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

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

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

iommu: sprd: Avoid NULL deref in sprd_iommu_hw_en

In sprd_iommu_cleanup() before calling function sprd_iommu_hw_en()
dom->sdev is equal to NULL, which leads to null dereference.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

The Linux kernel CVE team has assigned CVE-2024-42277 to this issue.

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

	Issue introduced in 5.15.113 with commit 92c089a931fd and fixed in 5.15.165 with commit 8c79ceb4ecf8
	Issue introduced in 6.1.81 with commit 8745f3592ee4 and fixed in 6.1.103 with commit dfe90030a0cf
	Issue introduced in 6.4 with commit 9afea57384d4 and fixed in 6.6.44 with commit b62841e49a2b
	Issue introduced in 6.4 with commit 9afea57384d4 and fixed in 6.10.3 with commit d5fe884ce28c
	Issue introduced in 6.4 with commit 9afea57384d4 and fixed in 6.11 with commit 630482ee0653
	Issue introduced in 6.3.4 with commit d0a917fd5e3b

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-2024-42277
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/sprd-iommu.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/8c79ceb4ecf823e6ec10fee6febb0fca3de79922
	https://git.kernel.org/stable/c/dfe90030a0cfa26dca4cb6510de28920e5ad22fb
	https://git.kernel.org/stable/c/b62841e49a2b7938f6fdeaaf93fb57e4eb880bdb
	https://git.kernel.org/stable/c/d5fe884ce28c5005f8582c35333c195a168f841c
	https://git.kernel.org/stable/c/630482ee0653decf9e2482ac6181897eb6cde5b8