CVE-2022-50146: PCI: dwc: Deallocate EPC memory on dw_pcie_ep_init() errors
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
PCI: dwc: Deallocate EPC memory on dw_pcie_ep_init() errors
If dw_pcie_ep_init() fails to perform any action after the EPC memory is initialized and the MSI memory region is allocated, the latter parts won't be undone thus causing a memory leak. Add a cleanup-on-error path to fix these leaks.
[bhelgaas: commit log]
The Linux kernel CVE team has assigned CVE-2022-50146 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.16 with commit 2fd0c9d966cc11bb5f73556dd788d12f501d8755 and fixed in 5.10.137 with commit e7599a5974d4c64eaae8009c3f2e47b9e3223e07 Issue introduced in 4.16 with commit 2fd0c9d966cc11bb5f73556dd788d12f501d8755 and fixed in 5.15.61 with commit b03a8f1264ea8c363bec9ef6e37b467f27cb04ea Issue introduced in 4.16 with commit 2fd0c9d966cc11bb5f73556dd788d12f501d8755 and fixed in 5.18.18 with commit 2d546db5c80c45cac3ccd929550244fd58f4ff58 Issue introduced in 4.16 with commit 2fd0c9d966cc11bb5f73556dd788d12f501d8755 and fixed in 5.19.2 with commit 3b453f5d06d1f1d6b20a75ea51dc7b53ae78f479 Issue introduced in 4.16 with commit 2fd0c9d966cc11bb5f73556dd788d12f501d8755 and fixed in 6.0 with commit 8161e9626b50892eaedbd8070ecb1586ecedb109
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-2022-50146
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/pcie-designware-ep.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/e7599a5974d4c64eaae8009c3f2e47b9e3223e07 https://git.kernel.org/stable/c/b03a8f1264ea8c363bec9ef6e37b467f27cb04ea https://git.kernel.org/stable/c/2d546db5c80c45cac3ccd929550244fd58f4ff58 https://git.kernel.org/stable/c/3b453f5d06d1f1d6b20a75ea51dc7b53ae78f479 https://git.kernel.org/stable/c/8161e9626b50892eaedbd8070ecb1586ecedb109