drivers/ata/libata-scsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Call scsi_device_put() in ata_scsi_dev_rescan() if the device or its
queue are not running.
Fixes: 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
Cc: stable@vger.kernel.org
Signed-off-by: Yihang Li <liyihang9@h-partners.com>
---
drivers/ata/libata-scsi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b43a3196e2be..3fb84f690644 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4894,8 +4894,10 @@ void ata_scsi_dev_rescan(struct work_struct *work)
spin_unlock_irqrestore(ap->lock, flags);
if (do_resume) {
ret = scsi_resume_device(sdev);
- if (ret == -EWOULDBLOCK)
+ if (ret == -EWOULDBLOCK) {
+ scsi_device_put(sdev);
goto unlock_scan;
+ }
dev->flags &= ~ATA_DFLAG_RESUMING;
}
ret = scsi_rescan_device(sdev);
--
2.33.0
On Thu, 20 Nov 2025 11:50:23 +0800, Yihang Li wrote:
> Call scsi_device_put() in ata_scsi_dev_rescan() if the device or its
> queue are not running.
>
>
Applied to libata/linux.git (for-6.18-fixes), thanks!
[1/1] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan()
https://git.kernel.org/libata/linux/c/b32cc17d
Kind regards,
Niklas
On 11/20/25 12:50 PM, Yihang Li wrote:
> Call scsi_device_put() in ata_scsi_dev_rescan() if the device or its
> queue are not running.
>
> Fixes: 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yihang Li <liyihang9@h-partners.com>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
© 2016 - 2025 Red Hat, Inc.