[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250421081604.655282-4-bbelyavtsev@usergate.com>
Date: Mon, 21 Apr 2025 15:16:04 +0700
From: Boris Belyavtsev <bbelyavtsev@...rgate.com>
To: <hare@...e.com>
CC: <linux-scsi@...r.kernel.org>,<linux-kernel@...r.kernel.org>,<lvc-project@...uxtesting.org>,Boris Belyavtsev <bbelyavtsev@...rgate.com>
Subject: [PATCH 6.1 v2 3/3] scsi: aic79xx: check for non-NULL scb in
ahd_linux_queue_abort_cmd
possible NULL pointer dereference in case hardware returns invalid scb
index.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 73a254621007 ("[SCSI] aic79xx: update to use scsi_transport_spi")
Signed-off-by: Boris Belyavtsev <bbelyavtsev@...rgate.com>
---
drivers/scsi/aic7xxx/aic79xx_osm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 17dfc3c72110..f2ae202d2641 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -2265,7 +2265,8 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd)
* and hope that the target responds.
*/
pending_scb = ahd_lookup_scb(ahd, active_scbptr);
- pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT;
+ if (pending_scb != NULL)
+ pending_scb->flags |= SCB_RECOVERY_SCB|SCB_ABORT;
ahd_outb(ahd, MSG_OUT, HOST_MSG);
ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
scmd_printk(KERN_INFO, cmd, "Device is active, asserting ATN\n");
--
2.43.0
Powered by blists - more mailing lists