Skip to content

Commit c67e638

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: aic79xx: Do not reference SCSI command when resetting device
When sending a device reset we should not take a reference to the SCSI command. Signed-off-by: Hannes Reinecke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 9cc9ef2 commit c67e638

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

drivers/scsi/aic7xxx/aic79xx_osm.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
536536
struct scsi_cmnd *cmd;
537537

538538
cmd = scb->io_ctx;
539-
ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
540-
scsi_dma_unmap(cmd);
539+
if (cmd) {
540+
ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
541+
scsi_dma_unmap(cmd);
542+
}
541543
}
542544

543545
/******************************** Macros **************************************/
@@ -814,7 +816,7 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)
814816

815817
tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
816818
cmd->device->id, &tstate);
817-
reset_scb->io_ctx = cmd;
819+
reset_scb->io_ctx = NULL;
818820
reset_scb->platform_data->dev = dev;
819821
reset_scb->sg_count = 0;
820822
ahd_set_residual(reset_scb, 0);
@@ -1769,9 +1771,16 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
17691771
dev = scb->platform_data->dev;
17701772
dev->active--;
17711773
dev->openings++;
1772-
if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) {
1773-
cmd->result &= ~(CAM_DEV_QFRZN << 16);
1774-
dev->qfrozen--;
1774+
if (cmd) {
1775+
if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) {
1776+
cmd->result &= ~(CAM_DEV_QFRZN << 16);
1777+
dev->qfrozen--;
1778+
}
1779+
} else if (scb->flags & SCB_DEVICE_RESET) {
1780+
if (ahd->platform_data->eh_done)
1781+
complete(ahd->platform_data->eh_done);
1782+
ahd_free_scb(ahd, scb);
1783+
return;
17751784
}
17761785
ahd_linux_unmap_scb(ahd, scb);
17771786

0 commit comments

Comments
 (0)