[lvc-project] [PATCH 6.1 v2 1/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_seqint
Boris Belyavtsev
bbelyavtsev at usergate.com
Mon Apr 21 11:16:02 MSK 2025
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 at usergate.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
More information about the lvc-project
mailing list