Skip to content

Commit c7f4c5d

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: aic79xx: Fix up NULL command in ahd_done()
Found by smatch. Fixes: c67e638 ("scsi: aic79xx: Do not reference SCSI command when resetting device") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Hannes Reinecke <hare@suse.de> Link: https://lore.kernel.org/r/20231023073014.21438-1-hare@suse.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 4b1c079 commit c7f4c5d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/scsi/aic7xxx/aic79xx_osm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
18341834
} else {
18351835
ahd_set_transaction_status(scb, CAM_REQ_CMP);
18361836
}
1837-
} else if (ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
1837+
} else if (cmd &&
1838+
ahd_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) {
18381839
ahd_linux_handle_scsi_status(ahd, cmd->device, scb);
18391840
}
18401841

@@ -1868,7 +1869,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
18681869
}
18691870

18701871
ahd_free_scb(ahd, scb);
1871-
ahd_linux_queue_cmd_complete(ahd, cmd);
1872+
if (cmd)
1873+
ahd_linux_queue_cmd_complete(ahd, cmd);
18721874
}
18731875

18741876
static void

0 commit comments

Comments
 (0)