Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tyrel Datwyler" <tyreld@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v9 2/9] scsi: ibmvfc: add NOOP command support
Date: Fri, 11 Sep 2026 02:31:07 +0000	[thread overview]
Message-ID: <20260911023107.AF63E1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260911021910.1038128-3-tyreld@linux.ibm.com>

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

Pre-existing issues:
- [High] Untrusted hypervisor input (`crq->ioba`) is dereferenced prior to validation, leading to a potential unmapped page fault (kernel panic).
--

commit 186cace34a3b58dd32c18fecc8f7d21b71c9763c
Author: Dave Marquardt <davemarq@linux.ibm.com>

scsi: ibmvfc: add NOOP command support

This commit adds support for handling IBMVFC_NOOP format CRQ messages from
the VIOS partner and advertises this capability during login. It updates
CRQ handlers to ignore NOOP messages while logging rate-limited errors if
the partner did not advertise support. Finally, it fixes a typo and adds a
null check for event pointers in ibmvfc_handle_scrq().

> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
> index 5259a80958ce1..6b2eb82ceb98d 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
[ ... ]
> @@ -4225,7 +4235,20 @@ 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) {
> +		if (vhost->state == IBMVFC_ACTIVE &&
> +		    !ibmvfc_check_caps(vhost, IBMVFC_SUPPORT_NOOP_CMD))
> +			dev_err_ratelimited(vhost->dev,
> +					    "Received unexpected NOOP command from partner\n");
> +		return;
> +	}
> +
> +	if (unlikely(!evt)) {
> +		dev_err(vhost->dev, "Received null event\n");
>  		return;
>  	}
>  
>  	/* The only kind of payload CRQs we should get are responses to
>  	 * things we send. Make sure this response is to something we
>  	 * actually sent
>  	 */
>  	if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) {

[Severity: High]
This isn't a bug introduced by this patch, but does ibmvfc_handle_scrq()
dereference the unvalidated evt pointer?

Since evt is derived from an untrusted hypervisor value (crq->ioba), if the
hypervisor sends an invalid non-null pointer, evaluating &evt->queue->evt_pool
will dereference evt->queue before ibmvfc_valid_event() can check if evt
falls within the legitimate event pool bounds. Can this cause an unmapped
page fault and kernel panic?

Should the implementation bypass the untrusted pointer entirely when locating
the event pool, for instance by passing the actual scrq object from the
caller?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260911021910.1038128-1-tyreld@linux.ibm.com?part=2

  reply	other threads:[~2026-09-11  2:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  2:19 [PATCH v9 0/9] scsi: ibmvfc: make ibmvfc support FPIN messages Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 1/9] scsi: ibmvfc: add basic FPIN support Tyrel Datwyler
2026-09-11  2:38   ` sashiko-bot
2026-09-11  3:40     ` Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 2/9] scsi: ibmvfc: add NOOP command support Tyrel Datwyler
2026-09-11  2:31   ` sashiko-bot [this message]
2026-09-11  3:41     ` Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 3/9] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 4/9] scsi: ibmvfc: extend async event handlers for async sub-CRQ events Tyrel Datwyler
2026-09-11  2:39   ` sashiko-bot
2026-09-11  3:52     ` Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 5/9] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Tyrel Datwyler
2026-09-11  2:44   ` sashiko-bot
2026-09-11  3:53     ` Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 6/9] scsi: ibmvfc: extend channel reg/dereg helpers for async sub-CRQ Tyrel Datwyler
2026-09-11  2:19 ` [PATCH v9 7/9] scsi: ibmvfc: fix IRQ leak and guard deregister on channel reg failure Tyrel Datwyler
2026-09-11  2:34   ` sashiko-bot
2026-09-11  2:19 ` [PATCH v9 8/9] scsi: ibmvfc: register and use asynchronous sub CRQ for events Tyrel Datwyler
2026-09-11  2:40   ` sashiko-bot
2026-09-11  2:19 ` [PATCH v9 9/9] scsi: ibmvfc: handle extended FPIN events Tyrel Datwyler
2026-09-11  2:40   ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-09-09 19:07 [PATCH v8 0/9] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-09-11  2:08 ` [PATCH v9 2/9] scsi: ibmvfc: add NOOP command support Tyrel Datwyler
2026-09-11  2:21   ` 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=20260911023107.AF63E1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tyreld@linux.ibm.com \
    /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