* [PATCH] PCI/ACPI: Fix double free bug in pci_acpi_scan_root() function
@ 2025-06-16 8:44 Zhe Qiao
2025-06-16 11:15 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Zhe Qiao @ 2025-06-16 8:44 UTC (permalink / raw)
To: sashal, rafael, lenb, bhelgaas, kwilczynski, qiaozhe
Cc: linux-kernel, linux-pci, linux-acpi
Fix the double free bug introduced in the patch "PCI/ACPI: Fix
allocated memory release on error in pci_acpi_scan_root()".
Fixes: 631b2af2f357 ("PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()")
Signed-off-by: Zhe Qiao <qiaozhe@iscas.ac.cn>
---
drivers/pci/pci-acpi.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index b78e0e417324..49b72596ae37 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -1653,15 +1653,7 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
}
/* release_info: free resources allocated by init_info */
-static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci)
-{
- struct acpi_pci_generic_root_info *ri;
-
- ri = container_of(ci, struct acpi_pci_generic_root_info, common);
- pci_ecam_free(ri->cfg);
- kfree(ci->ops);
- kfree(ri);
-}
+static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci) {}
/* Interface called from ACPI code to setup PCI host controller */
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI/ACPI: Fix double free bug in pci_acpi_scan_root() function
2025-06-16 8:44 [PATCH] PCI/ACPI: Fix double free bug in pci_acpi_scan_root() function Zhe Qiao
@ 2025-06-16 11:15 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2025-06-16 11:15 UTC (permalink / raw)
To: Zhe Qiao
Cc: sashal, rafael, lenb, bhelgaas, kwilczynski, linux-kernel,
linux-pci, linux-acpi
On Mon, Jun 16, 2025 at 10:44 AM Zhe Qiao <qiaozhe@iscas.ac.cn> wrote:
>
> Fix the double free bug introduced in the patch "PCI/ACPI: Fix
> allocated memory release on error in pci_acpi_scan_root()".
More details, please.
What's the bug and why is this the best fix?
> Fixes: 631b2af2f357 ("PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()")
> Signed-off-by: Zhe Qiao <qiaozhe@iscas.ac.cn>
> ---
> drivers/pci/pci-acpi.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index b78e0e417324..49b72596ae37 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -1653,15 +1653,7 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root)
> }
>
> /* release_info: free resources allocated by init_info */
> -static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci)
> -{
> - struct acpi_pci_generic_root_info *ri;
> -
> - ri = container_of(ci, struct acpi_pci_generic_root_info, common);
> - pci_ecam_free(ri->cfg);
> - kfree(ci->ops);
> - kfree(ri);
> -}
> +static void pci_acpi_generic_release_info(struct acpi_pci_root_info *ci) {}
Why don't you add a check for info->ops->release_info to
__acpi_pci_root_release_info() and drop this altogether?
> /* Interface called from ACPI code to setup PCI host controller */
> struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
> --
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-16 11:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 8:44 [PATCH] PCI/ACPI: Fix double free bug in pci_acpi_scan_root() function Zhe Qiao
2025-06-16 11:15 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).