[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250421081604.655282-2-bbelyavtsev@usergate.com>
Date: Mon, 21 Apr 2025 15:16:02 +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 1/3] scsi: aic79xx: check for non-NULL scb in
ahd_handle_seqint
NULL pointer dereference is possible when compiled with AHD_DEBUG and
AHD_SHOW_RECOVERY is set if data in SCBPTR и SCBPTR+1 ports is
incorrect.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Boris Belyavtsev <bbelyavtsev@...rgate.com>
---
drivers/scsi/aic7xxx/aic79xx_core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index f9372a81cd4e..a4d5376123d3 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -2205,13 +2205,16 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
ahd_print_path(ahd, scb);
printk("data overrun detected %s. Tag == 0x%x.\n",
ahd_lookup_phase_entry(lastphase)->phasemsg,
- SCB_GET_TAG(scb));
+ scb != NULL ? SCB_GET_TAG(scb) : 0);
ahd_print_path(ahd, scb);
printk("%s seen Data Phase. Length = %ld. "
"NumSGs = %d.\n",
ahd_inb(ahd, SEQ_FLAGS) & DPHASE
? "Have" : "Haven't",
- ahd_get_transfer_length(scb), scb->sg_count);
+ scb != NULL ? ahd_get_transfer_length(scb) : -1,
+ scb != NULL ? scb->sg_count : -1);
+ if (scb == NULL)
+ break;
ahd_dump_sglist(scb);
}
#endif
--
2.43.0
Powered by blists - more mailing lists