Re: [PATCH] Revert "PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()"
From: Rafael J. Wysocki
Date: Mon Jun 23 2025 - 16:17:13 EST
On Thu, Jun 19, 2025 at 4:30 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> On Thu, Jun 19, 2025 at 03:26:08PM +0800, Zhe Qiao wrote:
> > This reverts commit 631b2af2f35737750af284be22e63da56bf20139.
> >
> > The reverted patch causes the 'ri->cfg' and 'root_ops' resources to be
> > released multiple times.
> >
> > When acpi_pci_root_create() fails, these resources have already been
> > released internally by the __acpi_pci_root_release_info() function.
> > Releasing them again in pci_acpi_scan_root() leads to incorrect behavior
> > and potential memory issues.
> >
> > We plan to resolve the issue using a more appropriate fix.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Closes: https://lore.kernel.org/all/aEmdnuw715btq7Q5@stanley.mountain/
> > Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Signed-off-by: Zhe Qiao <qiaozhe@xxxxxxxxxxx>
>
> Acked-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> Reverting is probably the simplest option. There is still an issue in
> the code where in acpi_pci_root_create() the goto out_release_info
> doesn't free sysdata except on the last goto. So there is a small
> leak. But it's probably more theoretical than real.
Applied as 6.16-rc material, thanks!