mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_ign_wide_residue()
@ 2024-04-01  6:34 Aleksandr Aprelkov
  0 siblings, 0 replies; only message in thread
From: Aleksandr Aprelkov @ 2024-04-01  6:34 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Aleksandr Aprelkov, James E.J. Bottomley, Martin K. Petersen,
	linux-scsi, linux-kernel, lvc-project

If ahd_lookup_scb() returns NULL and (ahd_inb() & DPHASE) != 0
NULL pointer dereference happens inside ahd_get_transfer_dir()

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

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 3e3100dbfda3..bac23ee11c62 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -5664,7 +5664,7 @@ ahd_handle_ign_wide_residue(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
 	 * Perhaps add datadir to some spare bits in the hscb?
 	 */
 	if ((ahd_inb(ahd, SEQ_FLAGS) & DPHASE) == 0
-	 || ahd_get_transfer_dir(scb) != CAM_DIR_IN) {
+	 || (scb && ahd_get_transfer_dir(scb) != CAM_DIR_IN)) {
 		/*
 		 * Ignore the message if we haven't
 		 * seen an appropriate data phase yet.
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-01  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-01  6:34 [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_ign_wide_residue() Aleksandr Aprelkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®