Skip to content

Commit 1887a4f

Browse files
Xingui Yanggregkh
Xingui Yang
authored andcommitted
scsi: libsas: Grab the ATA port lock in sas_ata_device_link_abort()
commit a67aad5 upstream. Grab the ATA port lock in sas_ata_device_link_abort() before calling ata_link_abort() as outlined in this function's locking requirements. Fixes: 4411292 ("scsi: libsas: Add sas_ata_device_link_abort()") Signed-off-by: Xingui Yang <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Jason Yan <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6dc7e36 commit 1887a4f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/libsas/sas_ata.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,14 +890,17 @@ void sas_ata_device_link_abort(struct domain_device *device, bool force_reset)
890890
{
891891
struct ata_port *ap = device->sata_dev.ap;
892892
struct ata_link *link = &ap->link;
893+
unsigned long flags;
893894

895+
spin_lock_irqsave(ap->lock, flags);
894896
device->sata_dev.fis[2] = ATA_ERR | ATA_DRDY; /* tf status */
895897
device->sata_dev.fis[3] = ATA_ABORTED; /* tf error */
896898

897899
link->eh_info.err_mask |= AC_ERR_DEV;
898900
if (force_reset)
899901
link->eh_info.action |= ATA_EH_RESET;
900902
ata_link_abort(link);
903+
spin_unlock_irqrestore(ap->lock, flags);
901904
}
902905
EXPORT_SYMBOL_GPL(sas_ata_device_link_abort);
903906

0 commit comments

Comments
 (0)