public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan()
@ 2025-11-20  3:50 Yihang Li
  2025-11-20  8:33 ` Damien Le Moal
  2025-11-20 12:16 ` Niklas Cassel
  0 siblings, 2 replies; 3+ messages in thread
From: Yihang Li @ 2025-11-20  3:50 UTC (permalink / raw)
  To: dlemoal, cassel, martin.petersen
  Cc: linux-ide, linux-kernel, liyihang9, liuyonglong

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan()
  2025-11-20  3:50 [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan() Yihang Li
@ 2025-11-20  8:33 ` Damien Le Moal
  2025-11-20 12:16 ` Niklas Cassel
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2025-11-20  8:33 UTC (permalink / raw)
  To: Yihang Li, cassel, martin.petersen; +Cc: linux-ide, linux-kernel, liuyonglong

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan()
  2025-11-20  3:50 [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan() Yihang Li
  2025-11-20  8:33 ` Damien Le Moal
@ 2025-11-20 12:16 ` Niklas Cassel
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2025-11-20 12:16 UTC (permalink / raw)
  To: dlemoal, martin.petersen, Yihang Li; +Cc: linux-ide, linux-kernel, liuyonglong

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-20 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20  3:50 [PATCH] ata: libata-scsi: Add missing scsi_device_put() in ata_scsi_dev_rescan() Yihang Li
2025-11-20  8:33 ` Damien Le Moal
2025-11-20 12:16 ` Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox