Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dave Marquardt" <davemarq@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v5 2/7] scsi: ibmvfc: Add NOOP command support
Date: Thu, 06 Aug 2026 15:45:08 +0000	[thread overview]
Message-ID: <20260806154508.D2E711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806-ibmvfc-fpin-support-v5-2-13fd6f8a8f8b@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Dereferencing the unvalidated, hardware-provided pointer `evt` to access `evt->queue` before validating the pointer itself, which can lead to out-of-bounds access, kernel panic, or arbitrary memory write.
--

--- Patch [2]: [PATCH v5 2/7] scsi: ibmvfc: Add NOOP command support ---
commit 62ab2a186e05dc64b296e88c19571f798767a9fa
Author: Dave Marquardt <davemarq@linux.ibm.com>

scsi: ibmvfc: Add NOOP command support

Adds support for VFC_NOOP messages from VIOS to enable keep-alive
functionality between the client and server. Defines the VFC_NOOP CRQ format
and handles it in the main and sub-CRQ handlers.

> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
> index 2829f4e4b5636..04a405b0860fa 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c

[ ... ]

> @@ -4212,7 +4222,15 @@ static void ibmvfc_handle_scrq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost
>  	case IBMVFC_CRQ_XPORT_EVENT:
>  		return;
>  	default:
> -		dev_err(vhost->dev, "Got and invalid message type 0x%02x\n", crq->valid);
> +		dev_err(vhost->dev, "Got an invalid message type 0x%02x\n", crq->valid);
> +		return;
> +	}
> +
> +	if (crq->format == IBMVFC_NOOP)
> +		return;
> +
> +	if (unlikely(!evt)) {
> +		dev_err(vhost->dev, "Received null event\n");
>  		return;
>  	}
>  

[Severity: Critical]
This is a pre-existing issue, but does this code dereference the
hardware-provided pointer before validating it?

Looking at ibmvfc_handle_scrq() in drivers/scsi/ibmvscsi/ibmvfc-core.c, evt is
cast directly from the untrusted crq->ioba field provided by the hypervisor:

    struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba);

Although the patch adds a check for a NULL evt, it then proceeds directly to:

    if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) {
        ...
    }

If the hypervisor sends a corrupted or malicious non-NULL ioba value, won't
accessing evt->queue here cause an out-of-bounds access or kernel panic before
the pointer is actually validated by ibmvfc_valid_event()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806-ibmvfc-fpin-support-v5-0-13fd6f8a8f8b@linux.ibm.com?part=2

  reply	other threads:[~2026-08-06 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 15:17 [PATCH v5 0/7] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-08-06 15:17 ` [PATCH v5 1/7] scsi: ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-08-06 15:32   ` sashiko-bot
2026-08-06 15:17 ` [PATCH v5 2/7] scsi: ibmvfc: Add NOOP command support Dave Marquardt via B4 Relay
2026-08-06 15:45   ` sashiko-bot [this message]
2026-08-06 15:17 ` [PATCH v5 3/7] scsi: ibmvfc: define asynchronous sub-queue Dave Marquardt via B4 Relay
2026-08-06 15:32   ` sashiko-bot
2026-08-06 15:17 ` [PATCH v5 4/7] scsi: ibmvfc: allocate " Dave Marquardt via B4 Relay
2026-08-06 15:38   ` sashiko-bot
2026-08-06 15:17 ` [PATCH v5 5/7] scsi: ibmvfc: extend async event handlers to handle async sub queue events Dave Marquardt via B4 Relay
2026-08-06 15:34   ` sashiko-bot
2026-08-06 15:17 ` [PATCH v5 6/7] scsi: ibmvfc: register and use asynchronous sub-queue for events Dave Marquardt via B4 Relay
2026-08-06 15:47   ` sashiko-bot
2026-08-06 15:17 ` [PATCH v5 7/7] scsi: ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay
2026-08-06 15:53   ` sashiko-bot

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=20260806154508.D2E711F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=davemarq@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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