CVE-2022-50868
Description
In the Linux kernel, the following vulnerability has been resolved:
hwrng: amd - Fix PCI device refcount leak
for_each_pci_dev() is implemented by pci_get_device(). The comment of pci_get_device() says that it will increase the reference count for the returned pci_dev and also decrease the reference count for the input pci_dev @from if it is not NULL.
If we break for_each_pci_dev() loop with pdev not NULL, we need to call pci_dev_put() to decrease the reference count. Add the missing pci_dev_put() for the normal and error path.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
A missing pci_dev_put() in the Linux kernel's AMD hwrng driver causes a PCI device refcount leak, potentially preventing device removal.
Vulnerability
Overview
CVE-2022-50868 describes a reference counting flaw in the Linux kernel's hwrng: amd driver. The for_each_pci_dev() macro, which internally uses pci_get_device(), increments the reference count of each PCI device it returns. If a loop iteration breaks while holding a non-NULL pdev (for example, when an error occurs or after successfully finding the desired device), the driver must call pci_dev_put() to decrement the reference count. The AMD hwrng driver omitted this call in both its normal completion path and its error path, leading to a persistent refcount leak [1][2][3][4].
Exploitation & Attack Surface
The vulnerability resides in device driver initialization and teardown code. An attacker would need local access and the ability to trigger the AMD hwrng driver's probe or remove sequence—typically by causing the hardware RNG device to be discovered or by attempting to unload the driver. No special privileges beyond basic system access are required, because the driver is commonly loaded automatically on systems with an AMD chipset that includes a hardware RNG. The bug manifests whenever the driver's loop over PCI devices exits prematurely, whether due to a successful match or an error condition [1][4].
Impact
A successful exploit of this refcount leak results in the PCI device's reference count never reaching zero. Consequently, the kernel will not properly release the device structure, preventing the driver from being unloaded and the PCI device from being safely removed or hot-unplugged. Over time, repeated driver load/unload cycles could exhaust kernel memory or lead to a denial-of-service condition on the system [1][2][3][4].
Mitigation
Status
Patches have been merged into the Linux kernel stable branches (commits visible in references [1] through [4]). System administrators should apply the latest kernel updates from their distribution to close this vulnerability. There is no indication that CVE-2022-50868 is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog [1][2][3][4].
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1Patches
9f1c97f72ffd5526c31694881e246f5eff2601199f8e029415998e5c30e832b79a5e56077cb348c7908632e10ecd012aeecadb5b0111eVulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
9- git.kernel.org/stable/c/1199f8e02941b326c60ab71a63002b7c80e38212nvd
- git.kernel.org/stable/c/2b79a5e560779b35e1164d57ae35c48b43373082nvd
- git.kernel.org/stable/c/2e10ecd012ae2b2a374b34f307e9bc1e6096c03dnvd
- git.kernel.org/stable/c/526c316948819d3ecd2bb20fe5e2580c51a1b760nvd
- git.kernel.org/stable/c/5998e5c30e839f73e62cb29e0d9617b0d16ccba3nvd
- git.kernel.org/stable/c/cb348c7908631dd9f60083a0a1542eab055d3edfnvd
- git.kernel.org/stable/c/e246f5eff26055bdcb61a2cc99c50af72a19680fnvd
- git.kernel.org/stable/c/ecadb5b0111ea19fc7c240bb25d424a94471eb7dnvd
- git.kernel.org/stable/c/f1c97f72ffd504f49882774e2ab689d982dc7afcnvd
News mentions
0No linked articles in our index yet.