CVE-2022-49219: vfio/pci: fix memory leak during D3hot to D0 transition
In the Linux kernel, the following vulnerability has been resolved:
vfio/pci: fix memory leak during D3hot to D0 transition
If 'vfiopcicoredevice::needspmrestore' is set (PCI device does not have NoSoftReset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfiopcicoredevice::pmsave' during D0->D3hot transition and same will be restored back during D3hot->D0 transition. For saving the PCI state locally, pcistoresavedstate() is being used and the pciloadandfreesavedstate() will free the allocated memory.
But for reset related IOCTLs, vfio driver calls PCI reset-related API's which will internally change the PCI power state back to D0. So, when the guest resumes, then it will get the current state as D0 and it will skip the call to vfiopcisetpowerstate() for changing the power state to D0 explicitly. In this case, the memory pointed by 'pmsave' will never be freed. In a malicious sequence, the state changing to D3hot followed by VFIODEVICERESET/VFIODEVICEPCIHOTRESET can be run in a loop and it can cause an OOM situation.
This patch frees the earlier allocated memory first before overwriting 'pmsave' to prevent the mentioned memory leak.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.17.3-1 - Upgrade
Upgrade
ubuntu/linux-azure-5.15to a version that resolves this vulnerability.Fixed in 5.15.0-1008.9~20.04.1 - Upgrade
Upgrade
ubuntu/linux-hwe-5.15to a version that resolves this vulnerability.Fixed in 5.15.0-41.44~20.04.1 - Upgrade
Upgrade
ubuntu/linux-intel-iotg-5.15to a version that resolves this vulnerability.Fixed in 5.15.0-1008.11~20.04.1 - Upgrade
Upgrade
ubuntu/linux-lowlatency-hwe-5.15to a version that resolves this vulnerability.Fixed in 5.15.0-42.45~20.04.1 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 5.15.0-37.39 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 5.15.0-1011.14 - Upgrade
Upgrade
ubuntu/linux-azureto a version that resolves this vulnerability.Fixed in 5.15.0-1010.12 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 5.15.0-1008.12 - Upgrade
Upgrade
ubuntu/linux-gketo a version that resolves this vulnerability.Fixed in 5.15.0-1008.10 - Upgrade
Upgrade
ubuntu/linux-ibmto a version that resolves this vulnerability.Fixed in 5.15.0-1007.8 - Upgrade
Upgrade
ubuntu/linux-intel-iotgto a version that resolves this vulnerability.Fixed in 5.15.0-1008.11 - Upgrade
Upgrade
ubuntu/linux-kvmto a version that resolves this vulnerability.Fixed in 5.15.0-1010.11 - Upgrade
Upgrade
ubuntu/linux-lowlatencyto a version that resolves this vulnerability.Fixed in 5.15.0-37.39 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 5.15.0-1009.12 - Upgrade
Upgrade
ubuntu/linux-raspito a version that resolves this vulnerability.Fixed in 5.15.0-1011.13 - Upgrade
Upgrade
ubuntu/linux-realtimeto a version that resolves this vulnerability.Fixed in 5.15.0-1014.14 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.237 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.33 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.16.19 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.17.2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.115-2Fixed in 7.2.15-1
Event History
Frequently Asked Questions
What is the severity of CVE-2022-49219?
CVE-2022-49219 is categorized as a low severity vulnerability in the Linux kernel due to a memory leak during the D3hot to D0 transition.
How do I fix CVE-2022-49219?
To fix CVE-2022-49219, upgrade to a patched version of the Linux kernel where this vulnerability has been addressed.
What versions of the Linux kernel are affected by CVE-2022-49219?
CVE-2022-49219 affects Linux kernels from version 5.1 to 5.17.2, as well as 5.15.33 to 5.16.19.
What component in the Linux kernel is affected by CVE-2022-49219?
CVE-2022-49219 specifically affects the vfio/pci component of the Linux kernel.
What does CVE-2022-49219 impact?
CVE-2022-49219 impacts system stability by causing a memory leak when transitioning PCI devices from low power to active states.