Message ID | 20231023073014.21438-1-hare@suse.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | aic79xx: fix up NULL command in ahd_done() | expand |
On Mon, Oct 23, 2023 at 09:30:14AM +0200, Hannes Reinecke wrote: > +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c > @@ -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.
Hannes,
> Found by smatch.
Applied to 6.7/scsi-staging, thanks!
On Mon, 23 Oct 2023 09:30:14 +0200, Hannes Reinecke wrote: > 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
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index b3075a022d99..77c91a405d20 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -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
Found by smatch. Fixes: c67e63800446 ("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> --- drivers/scsi/aic7xxx/aic79xx_osm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)