1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

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 <hare@suse.de>
Link: https://lore.kernel.org/r/20231002154328.43718-10-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Hannes Reinecke 2023-10-02 17:43:19 +02:00 committed by Martin K. Petersen
parent 9cc9ef2819
commit c67e638004

View file

@ -536,9 +536,11 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
cmd = scb->io_ctx; cmd = scb->io_ctx;
if (cmd) {
ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE); ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
scsi_dma_unmap(cmd); scsi_dma_unmap(cmd);
} }
}
/******************************** Macros **************************************/ /******************************** Macros **************************************/
static inline unsigned int ahd_build_scsiid(struct ahd_softc *ahd, static inline unsigned int ahd_build_scsiid(struct ahd_softc *ahd,
@ -814,7 +816,7 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd)
tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
cmd->device->id, &tstate); cmd->device->id, &tstate);
reset_scb->io_ctx = cmd; reset_scb->io_ctx = NULL;
reset_scb->platform_data->dev = dev; reset_scb->platform_data->dev = dev;
reset_scb->sg_count = 0; reset_scb->sg_count = 0;
ahd_set_residual(reset_scb, 0); ahd_set_residual(reset_scb, 0);
@ -1769,10 +1771,17 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
dev = scb->platform_data->dev; dev = scb->platform_data->dev;
dev->active--; dev->active--;
dev->openings++; dev->openings++;
if (cmd) {
if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) { if ((cmd->result & (CAM_DEV_QFRZN << 16)) != 0) {
cmd->result &= ~(CAM_DEV_QFRZN << 16); cmd->result &= ~(CAM_DEV_QFRZN << 16);
dev->qfrozen--; dev->qfrozen--;
} }
} else if (scb->flags & SCB_DEVICE_RESET) {
if (ahd->platform_data->eh_done)
complete(ahd->platform_data->eh_done);
ahd_free_scb(ahd, scb);
return;
}
ahd_linux_unmap_scb(ahd, scb); ahd_linux_unmap_scb(ahd, scb);
/* /*