Commit 7933650
committed
ata: libata-scsi: Fix ata_scsi_dev_rescan() error path
Commit 0c76106 ("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: 0c76106 ("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>1 parent 24cfd86 commit 7933650
1 file changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4745 | 4745 | | |
4746 | 4746 | | |
4747 | 4747 | | |
4748 | | - | |
| 4748 | + | |
4749 | 4749 | | |
4750 | 4750 | | |
4751 | 4751 | | |
| |||
4758 | 4758 | | |
4759 | 4759 | | |
4760 | 4760 | | |
4761 | | - | |
| 4761 | + | |
4762 | 4762 | | |
4763 | 4763 | | |
4764 | 4764 | | |
4765 | 4765 | | |
4766 | 4766 | | |
4767 | 4767 | | |
4768 | 4768 | | |
4769 | | - | |
| 4769 | + | |
4770 | 4770 | | |
4771 | 4771 | | |
4772 | 4772 | | |
4773 | | - | |
| 4773 | + | |
4774 | 4774 | | |
| 4775 | + | |
4775 | 4776 | | |
4776 | 4777 | | |
4777 | 4778 | | |
| |||
0 commit comments