* [PATCH] ACPI: PCI: link: clear driver_data before free
@ 2026-09-25 15:58 Jiale Yao
2026-09-25 16:06 ` sashiko-bot
2026-10-12 15:35 ` Rafael J. Wysocki (Intel)
0 siblings, 2 replies; 3+ messages in thread
From: Jiale Yao @ 2026-09-25 15:58 UTC (permalink / raw)
To: Bjorn Helgaas, Rafael J. Wysocki, Len Brown, Andrew Morton,
Pavel Machek, linux-pci, linux-acpi, linux-kernel
Cc: Jiale Yao
acpi_pci_link_remove() frees the link object without clearing the ACPI
device's driver_data pointer. The ACPI device survives hot-removal and
can later be retrieved by acpi_fetch_acpi_dev(), leaving callers with a
dangling pointer.
Clear driver_data before freeing the link.
Fixes: db89b4f0dbab ("ACPI: catch calls of acpi_driver_data on pointer of wrong type")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/acpi/pci_link.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index e6ed13aee48d..84bfcdf242dd 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -787,6 +787,7 @@ static void acpi_pci_link_remove(struct acpi_device *device)
list_del(&link->list);
mutex_unlock(&acpi_link_lock);
+ device->driver_data = NULL;
kfree(link);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI: PCI: link: clear driver_data before free
2026-09-25 15:58 [PATCH] ACPI: PCI: link: clear driver_data before free Jiale Yao
@ 2026-09-25 16:06 ` sashiko-bot
2026-10-12 15:35 ` Rafael J. Wysocki (Intel)
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-25 16:06 UTC (permalink / raw)
To: Jiale Yao; +Cc: linux-pci
> acpi_pci_link_remove() frees the link object without clearing the ACPI
> device's driver_data pointer. The ACPI device survives hot-removal and
> can later be retrieved by acpi_fetch_acpi_dev(), leaving callers with a
> dangling pointer.
>
> Clear driver_data before freeing the link.
>
> Fixes: db89b4f0dbab ("ACPI: catch calls of acpi_driver_data on pointer of wrong type")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260925155846.2381956-1-yaojiale02@163.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI: PCI: link: clear driver_data before free
2026-09-25 15:58 [PATCH] ACPI: PCI: link: clear driver_data before free Jiale Yao
2026-09-25 16:06 ` sashiko-bot
@ 2026-10-12 15:35 ` Rafael J. Wysocki (Intel)
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-10-12 15:35 UTC (permalink / raw)
To: Jiale Yao
Cc: Bjorn Helgaas, Rafael J. Wysocki, Len Brown, Andrew Morton,
Pavel Machek, linux-pci, linux-acpi, linux-kernel
On Fri, Sep 25, 2026 at 5:59 PM Jiale Yao <yaojiale02@163.com> wrote:
>
> acpi_pci_link_remove() frees the link object without clearing the ACPI
> device's driver_data pointer. The ACPI device survives hot-removal and
> can later be retrieved by acpi_fetch_acpi_dev(), leaving callers with a
> dangling pointer.
>
> Clear driver_data before freeing the link.
>
> Fixes: db89b4f0dbab ("ACPI: catch calls of acpi_driver_data on pointer of wrong type")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
> drivers/acpi/pci_link.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
> index e6ed13aee48d..84bfcdf242dd 100644
> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -787,6 +787,7 @@ static void acpi_pci_link_remove(struct acpi_device *device)
> list_del(&link->list);
> mutex_unlock(&acpi_link_lock);
>
> + device->driver_data = NULL;
> kfree(link);
> }
>
> --
Applied as 7.4 material, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-12 15:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25 15:58 [PATCH] ACPI: PCI: link: clear driver_data before free Jiale Yao
2026-09-25 16:06 ` sashiko-bot
2026-10-12 15:35 ` Rafael J. Wysocki (Intel)
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.