aic79xx: fix up NULL command in ahd_done()
Subsystems (2)
PATCH 1/1 aic79xx: fix up NULL command in ahd_done()
Found by smatch.
Fixes c67e63800446 ("scsi: aic79xx: Do not reference SCSI command when resetting device")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/scsi/aic7xxx/aic79xx_osm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm.c +3 -2
@@ -1834,7 +1834,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) }else {ahd_set_transaction_status (scb,CAM_REQ_CMP ); } - }else if (ahd_get_transaction_status (scb) ==CAM_SCSI_STATUS_ERROR ) { + }else if (cmd &&ahd_get_transaction_status (scb) ==CAM_SCSI_STATUS_ERROR ) {ahd_linux_handle_scsi_status (ahd, cmd->device, scb); }
@@ -1868,7 +1868,8 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) }ahd_free_scb (ahd, scb); -ahd_linux_queue_cmd_complete (ahd, cmd); +if (cmd) +ahd_linux_queue_cmd_complete (ahd, cmd); } static void
Signature · 1 line
2.35.3
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_done(struct ahd_softc *ahd, struct scb *scb) · line 1837
Quoted 7 lines · Hannes Reinecke
+++
b/drivers/scsi/aic7xxx/aic79xx_osm.cdrivers/scsi/aic7xxx/aic79xx_osm.c +1
-1@@ -1834,7 +1834,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) }else {ahd_set_transaction_status (scb,CAM_REQ_CMP ); } - }else if (ahd_get_transaction_status (scb) ==CAM_SCSI_STATUS_ERROR ) { + }else if (cmd &&ahd_get_transaction_status (scb) ==CAM_SCSI_STATUS_ERROR ) {
Please avoid the overly long line here.
Otherwise looks good.
Martin K. Petersen
AppliedHannes,
Quoted 1 line
Found by smatch.
Applied to 6.7/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 3 lines · Hannes Reinecke
Found by smatch.
Applied to 6.7/scsi-queue, thanks!
[1/1] aic79xx: fix up NULL command in ahd_done()
https://git.kernel.org/mkp/scsi/c/c7f4c5dec651
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering