mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Belyavtsev <bbelyavtsev@usergate.com>
To: <hare@suse.com>
Cc: <linux-scsi@vger.kernel.org>,<linux-kernel@vger.kernel.org>,<lvc-project@linuxtesting.org>,Boris
	Belyavtsev <bbelyavtsev@usergate.com>
Subject: [PATCH 6.1 v2 3/3] scsi: aic79xx: check for non-NULL scb in ahd_linux_queue_abort_cmd
Date: Mon, 21 Apr 2025 15:16:04 +0700	[thread overview]
Message-ID: <20250421081604.655282-4-bbelyavtsev@usergate.com> (raw)
In-Reply-To: <20250421081604.655282-1-bbelyavtsev@usergate.com>

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@usergate.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


  parent reply	other threads:[~2025-04-21  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21  8:16 [PATCH 6.1 v2 0/3] aic79xx: Add some non-NULL checks Boris Belyavtsev
2025-04-21  8:16 ` [PATCH 6.1 v2 1/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_seqint Boris Belyavtsev
2025-04-21  8:16 ` [PATCH 6.1 v2 2/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_pkt_busfree Boris Belyavtsev
2025-04-21  8:16 ` Boris Belyavtsev [this message]
2025-04-21 12:12 ` [PATCH 6.1 v2 0/3] aic79xx: Add some non-NULL checks James Bottomley
2025-04-28  4:32   ` Boris Belyavtsev
2025-04-28 12:07     ` James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250421081604.655282-4-bbelyavtsev@usergate.com \
    --to=bbelyavtsev@usergate.com \
    --cc=hare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®