* [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject()
@ 2024-04-01 6:10 Aleksandr Aprelkov
2024-04-01 7:10 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Aleksandr Aprelkov @ 2024-04-01 6:10 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_sent_msg() checks are false,
then NULL pointer dereference happens
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..9e0fafa12e87 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -5577,7 +5577,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
"Using asynchronous transfers\n",
ahd_name(ahd), devinfo->channel,
devinfo->target, devinfo->lun);
- } else if ((scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) {
+ } else if (scb && (scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) {
int tag_type;
int mask;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject()
2024-04-01 6:10 [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject() Aleksandr Aprelkov
@ 2024-04-01 7:10 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2024-04-01 7:10 UTC (permalink / raw)
To: Aleksandr Aprelkov, Hannes Reinecke
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, lvc-project
On 4/1/24 15:10, Aleksandr Aprelkov wrote:
> If ahd_lookup_scb() returns NULL and ahd_sent_msg() checks are false,
> then NULL pointer dereference happens
>
> 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..9e0fafa12e87 100644
> --- a/drivers/scsi/aic7xxx/aic79xx_core.c
> +++ b/drivers/scsi/aic7xxx/aic79xx_core.c
> @@ -5577,7 +5577,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
> "Using asynchronous transfers\n",
> ahd_name(ahd), devinfo->channel,
> devinfo->target, devinfo->lun);
> - } else if ((scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) {
> + } else if (scb && (scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) {
"!= 0" is not needed.
> int tag_type;
> int mask;
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-01 7:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-01 6:10 [PATCH] scsi: aic79xx: add scb NULL check in ahd_handle_msg_reject() Aleksandr Aprelkov
2024-04-01 7:10 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome