diff mbox series

[6.1,v2,2/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_pkt_busfree

Message ID 20250421081604.655282-3-bbelyavtsev@usergate.com
State New
Headers show
Series aic79xx: Add some non-NULL checks | expand

Commit Message

Boris Belyavtsev April 21, 2025, 8:16 a.m. UTC
If hardware returns invalid scbid scb could be NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Boris Belyavtsev <bbelyavtsev@usergate.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index a4d5376123d3..3595a1e35a69 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -2998,6 +2998,10 @@  ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
 		ahd_print_path(ahd, scb);
 		printk("Unexpected PKT busfree condition\n");
 		ahd_dump_card_state(ahd);
+		if (scb == NULL) {
+			printk("scb pointer is NULL\n");
+			return (1);
+		}
 		ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A',
 			       SCB_GET_LUN(scb), SCB_GET_TAG(scb),
 			       ROLE_INITIATOR, CAM_UNEXP_BUSFREE);