ACPI: PCI: link: clear driver_data before free
PATCH 1/1 ACPI: PCI: link: clear driver_data before free
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.
--- drivers/acpi/pci_link.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/pci_link.c +1 -0
@@ -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); }
Signature · 1 line
2.34.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines
acpi_pci_link_remove()frees the link object without clearing the ACPI device'sdriver_datapointer. The ACPI device survives hot-removal and can later be retrieved byacpi_fetch_acpi_dev(), leaving callers with a dangling pointer.Clear
driver_databefore freeing the link.Fixes db89b4f0dbab ("ACPI: catch calls of acpi_driver_data on pointer of wrong type")Signed-off-by Jiale Yao <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 19 lines · Jiale Yao
acpi_pci_link_remove()frees the link object without clearing the ACPI device'sdriver_datapointer. The ACPI device survives hot-removal and can later be retrieved byacpi_fetch_acpi_dev(), leaving callers with a dangling pointer.Clear
driver_databefore freeing the link.Fixes db89b4f0dbab ("ACPI: catch calls of acpi_driver_data on pointer of wrong type")Signed-off-by Jiale Yao <[email protected]>--- drivers/acpi/pci_link.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pci_link.c +0
-0
drivers/acpi/pci_link.c static void acpi_pci_link_remove(struct acpi_device *device)
Quoted 8 lines
drivers/acpi/pci_link.c +1
-1@@ -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!