From: sashiko-bot@kernel.org
To: "Chen Pei" <cp0613@linux.alibaba.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach
Date: Tue, 26 May 2026 03:12:00 +0000 [thread overview]
Message-ID: <20260526031200.C19341F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260526025118.38935-2-cp0613@linux.alibaba.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] acpi_pci_root_add() leaves a dangling pointer in device->driver_data on the dmar_device_add() error path.
--
commit c50bc9cc7a48e4b92d2f6107b97e5bdf5d2b47a4
Author: Chen Pei <cp0613@linux.alibaba.com>
ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach
This commit clears _DEP dependencies at the end of acpi_pci_root_add(),
allowing consumers like ACPI0017 CXL root devices to safely enumerate
once the PCI root bridge has been attached.
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index a0ba64e45e8ab..4c06c3ffd0cbb 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -755,6 +755,10 @@ static int acpi_pci_root_add(struct acpi_device *device,
> pci_lock_rescan_remove();
> pci_bus_add_devices(root->bus);
> pci_unlock_rescan_remove();
> +
> + /* Clear _DEP dependencies to allow consumers to enumerate */
> + acpi_dev_clear_dependencies(device);
> +
> return 1;
>
> remove_dmar:
> if (hotadd)
> dmar_device_remove(handle);
> end:
> kfree(root);
[Severity: High]
This is a pre-existing issue, but does the dmar_device_add() error path
leave a dangling pointer in device->driver_data?
Earlier in acpi_pci_root_add(), the allocated root object is assigned to
device->driver_data:
root->device = device;
root->segment = segment & 0xFFFF;
device->driver_data = root;
If dmar_device_add() fails during a hot-add, the code jumps to the end
label and frees the root pointer via kfree().
However, it doesn't explicitly reset device->driver_data to NULL, unlike
the later pci_acpi_scan_root() error path. Since the ACPI core does not
automatically clear driver_data on an attach failure, could subsequent calls
to acpi_pci_find_root() by other subsystems fetch and dereference this freed
pointer?
> return result;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260526025118.38935-1-cp0613@linux.alibaba.com?part=1
next prev parent reply other threads:[~2026-05-26 3:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 2:51 [PATCH 0/2] ACPI/PCI/CXL: Enforce _DEP ordering between ACPI0016 and ACPI0017 Chen Pei
2026-05-26 2:51 ` [PATCH 1/2] ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach Chen Pei
2026-05-26 3:12 ` sashiko-bot [this message]
2026-05-26 9:26 ` [PATCH] cxl/acpi: Defer probe when ACPI0016 PCI root bridge is not ready Chen Pei
2026-05-26 2:51 ` [PATCH 2/2] ACPI: scan: Honor _DEP for ACPI0016 PCI/CXL host bridge Chen Pei
2026-05-27 11:38 ` Rafael J. Wysocki
2026-05-26 15:01 ` [PATCH 0/2] ACPI/PCI/CXL: Enforce _DEP ordering between ACPI0016 and ACPI0017 Dave Jiang
2026-05-27 1:14 ` Alison Schofield
2026-06-01 17:27 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526031200.C19341F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cp0613@linux.alibaba.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.