mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Belyavtsev <bbelyavtsev@usergate.com>
To: <hare@suse.org>
Cc: <linux-scsi@vger.kernel.org>,<linux-kernel@vger.kernel.org>,"Boris
	Belyavtsev" <bbelyavtsev@usergate.com>
Subject: [PATCH 1/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_seqint
Date: Thu, 17 Apr 2025 11:20:13 +0700	[thread overview]
Message-ID: <20250417042015.780823-2-bbelyavtsev@usergate.com> (raw)
In-Reply-To: <20250417042015.780823-1-bbelyavtsev@usergate.com>

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.

Signed-off-by: Boris Belyavtsev <bbelyavtsev@usergate.com>
---
 drivers/scsi/aic7xxx/aic79xx_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index f9372a81cd4e..ff9ae0f8e153 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -2205,14 +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);
-                       ahd_dump_sglist(scb);
+                              scb != NULL ? ahd_get_transfer_length(scb) : -1,
+                              scb != NULL ? scb->sg_count : -1);
+                       if (scb != NULL)
+                               ahd_dump_sglist(scb);
                }
 #endif

--
2.43.0

Настоящее электронное сообщение содержит информацию конфиденциального характера, а также может содержать коммерческую тайну ООО «Юзергейт» ИНН 5408308256 (UserGate). Неправомерное использование / раскрытие таковой информации запрещено. Если вы получили настоящее сообщение по ошибке, пожалуйста, свяжитесь с отправителем и удалите все копии сообщения. Настоящее сообщение не является офертой. Сведения о планируемых к разработке технологических решениях, ценовой политике, иные содержащиеся в сообщении сведения имеют исключительно информационных характер и не должны быть расценены в качестве основания для возникновения обязательств любого свойства.

  reply	other threads:[~2025-04-17  5:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17  4:20 [PATCH 0/3] aic79xx: Add some non-NULL checks Boris Belyavtsev
2025-04-17  4:20 ` Boris Belyavtsev [this message]
2025-04-17  4:20 ` [PATCH 2/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_pkt_busfree Boris Belyavtsev
2025-04-17  4:20 ` [PATCH 3/3] scsi: aic79xx: check for non-NULL scb in ahd_linux_queue_abort_cmd Boris Belyavtsev
2025-04-17  4:22 [PATCH 0/3] aic79xx: Add some non-NULL checks Boris Belyavtsev
2025-04-17  4:22 ` [PATCH 1/3] scsi: aic79xx: check for non-NULL scb in ahd_handle_seqint Boris Belyavtsev

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=20250417042015.780823-2-bbelyavtsev@usergate.com \
    --to=bbelyavtsev@usergate.com \
    --cc=hare@suse.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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®