[PATCH v10 04/15] ata: libata-zpodd: publish initialized state before registering notifications

From: Phil Pemberton

Date: Fri Oct 09 2026 - 12:32:06 EST


zpodd_init() installs the ACPI notification handler before assigning
zpodd->dev and dev->zpodd. A notification delivered in that window can
enter zpodd_wake_dev() with a NULL context pointer. In particular,
initialization retried during EH can already have a suspended SCSI device,
allowing the callback to reach its from_notify assignment.

Initialize the back pointer and publish dev->zpodd before installing the
handler, so every callback observes initialized state. Keep removal of the
handler before freeing the state, as acpi_remove_notify_handler() waits
for queued notifications to complete.

Fixes: f064a20dded8 ("libata: move acpi notification code to zpodd")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Phil Pemberton <philpem@xxxxxxxxxxxxx>
---
drivers/ata/libata-zpodd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 581eb41ea0f3..c57c49316fbd 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -311,9 +311,9 @@ void zpodd_init(struct ata_device *dev)

zpodd->mech_type = mech_type;

- ata_acpi_add_pm_notifier(dev);
zpodd->dev = dev;
dev->zpodd = zpodd;
+ ata_acpi_add_pm_notifier(dev);
dev_pm_qos_expose_flags(&dev->tdev, 0);
}

--
2.43.0