Subject: CVE-2024-43823: PCI: keystone: Fix NULL pointer dereference in case of DT error in ks_pcie_setup_rc_app_regs()

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

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

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

PCI: keystone: Fix NULL pointer dereference in case of DT error in ks_pcie_setup_rc_app_regs()

If IORESOURCE_MEM is not provided in Device Tree due to
any error, resource_list_first_type() will return NULL and
pci_parse_request_of_pci_ranges() will just emit a warning.

This will cause a NULL pointer dereference. Fix this bug by adding NULL
return check.

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

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

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

	Issue introduced in 5.10 with commit 0f71c60ffd26 and fixed in 6.1.103 with commit bbba48ad67c5
	Issue introduced in 5.10 with commit 0f71c60ffd26 and fixed in 6.6.44 with commit 0a6f1b5fe8ef
	Issue introduced in 5.10 with commit 0f71c60ffd26 and fixed in 6.10.3 with commit dbcdd1863ba2
	Issue introduced in 5.10 with commit 0f71c60ffd26 and fixed in 6.11 with commit a231707a91f3

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-43823
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/pci/controller/dwc/pci-keystone.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/bbba48ad67c53feea05936ea1e029dcca8057506
	https://git.kernel.org/stable/c/0a6f1b5fe8ef8268aaa069035639968ceeea0a23
	https://git.kernel.org/stable/c/dbcdd1863ba2ec9b76ec131df25d797709e05597
	https://git.kernel.org/stable/c/a231707a91f323af1e5d9f1722055ec2fc1c7775