Files
linux/drivers
Damien Le Moal 341b5e1016 ata: libata-scsi: Fix ata_scsi_dev_rescan() error path
commit 79336504781e7fee5ddaf046dcc186c8dfdf60b1 upstream.

Commit 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
incorrectly handles failures of scsi_resume_device() in
ata_scsi_dev_rescan(), leading to a double call to
spin_unlock_irqrestore() to unlock a device port. Fix this by redefining
the goto labels used in case of errors and only unlock the port
scsi_scan_mutex when scsi_resume_device() fails.

Bug found with the Smatch static checker warning:

	drivers/ata/libata-scsi.c:4774 ata_scsi_dev_rescan()
	error: double unlocked 'ap->lock' (orig line 4757)

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 0c76106cb975 ("scsi: sd: Fix TCG OPAL unlock on system resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-17 11:19:25 +02:00
..
2023-08-22 15:50:57 +02:00
2023-08-24 16:20:30 -07:00
2024-04-03 15:28:28 +02:00
2024-04-10 16:35:45 +02:00
2023-11-20 11:59:19 +01:00
2024-02-05 20:14:15 +00:00
2024-04-03 15:28:52 +02:00
2024-04-10 16:35:42 +02:00
2024-01-20 11:51:48 +01:00
2024-03-26 18:20:10 -04:00
2023-08-21 13:27:44 +02:00