In the Linux kernel, the following vulnerability has been resolved: x86/amd_node: Fix PCI device reference counting in amd_smn_init() The local "root" pointer is a temporary variable used during the device search. Therefore, refcount related to the search iterators should be cleaned up after the search is complete. Use the __free() cleanup macro to ensure the refcount is decremented when the temporary pointer goes out of scope. Additionally, increment the refcount when caching a root pointer. This ensures the in-use refcount is separate from the temporary search refcounting. Finally, drop the redundant "root = NULL" before the second search loop. The pci_get_class() iterator always decrements the refcount of its "from" argument, so the first loop can only fall through with "root" already NULL.
https://git.kernel.org/stable/c/aa2a4277ad42fd8f918c6dc652473946a253f7b0
https://git.kernel.org/stable/c/84e3a71d11d8593c127b468d75b2653af5074f81
https://git.kernel.org/stable/c/27600805e62f800bacf990354632eae4e487d34c