mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 08:45:26 -05:00
PCI/ACPI: Fix pci_acpi_preserve_config() memory leak
pci_acpi_preserve_config() leaks memory by returning early without freeing
the ACPI object on success. Fix that by always freeing the obj, which is
not needed by the caller.
Fixes: 9d7d5db8e7 ("PCI: Move PRESERVE_BOOT_CONFIG _DSM evaluation to pci_register_host_bridge()")
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250825214642.142135-1-nirmoyd@nvidia.com
This commit is contained in:
committed by
Bjorn Helgaas
parent
8f5ae30d69
commit
fac679df75
@@ -122,6 +122,8 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
|
||||
|
||||
bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (ACPI_HANDLE(&host_bridge->dev)) {
|
||||
union acpi_object *obj;
|
||||
|
||||
@@ -135,11 +137,11 @@ bool pci_acpi_preserve_config(struct pci_host_bridge *host_bridge)
|
||||
1, DSM_PCI_PRESERVE_BOOT_CONFIG,
|
||||
NULL, ACPI_TYPE_INTEGER);
|
||||
if (obj && obj->integer.value == 0)
|
||||
return true;
|
||||
ret = true;
|
||||
ACPI_FREE(obj);
|
||||
}
|
||||
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* _HPX PCI Setting Record (Type 0); same as _HPP */
|
||||
|
||||
Reference in New Issue
Block a user