From: sashiko-bot@kernel.org
To: "Tyrel Datwyler" <tyreld@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v10 2/9] scsi: ibmvfc: add NOOP command support
Date: Fri, 11 Sep 2026 06:00:43 +0000 [thread overview]
Message-ID: <20260911060044.5D8F41F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911054832.1311668-3-tyreld@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a pre-existing high-severity issue in `ibmvfc_handle_scrq()`. The unvalidated pointer `evt` (derived directly from the hypervisor's untrusted `crq->ioba` payload) is dereferenced via `evt->queue` to determine which event pool to validate against. If the hypervisor provides a non-NULL garbage correlation token, this will trigger a kernel panic before the validation function can even execute.
--
commit 7bc4ed43b16179c365542ff5e1801c32adcc35f1
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. It handles and ignores NOOP messages in both
ibmvfc_handle_crq() and ibmvfc_handle_scrq(), while also logging unexpected
NOOP commands. Additionally, it fixes a typo and guards against null event
pointers before processing CRQ responses.
> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
> index 514fc87c10173..7ea64956653ef 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
[ ... ]
> @@ -4223,7 +4233,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;
> }
>
[Severity: High]
This isn't a bug introduced by this patch, but is it possible for a malformed
CRQ message to crash the host in ibmvfc_handle_scrq() here?
If the hypervisor (VIOS) returns a CRQ response with a non-NULL garbage
correlation token in crq->ioba, it will be cast to struct ibmvfc_event *evt.
The !evt check will pass, but immediately after this block, the code calls:
if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) {
This dereferences evt->queue to determine which event pool to validate against
before the pointer is actually validated. This could lead to an out-of-bounds
memory read and a kernel panic.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911054832.1311668-1-tyreld@linux.ibm.com?part=2
next prev parent reply other threads:[~2026-09-11 6:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 5:48 [PATCH v10 0/9] scsi: ibmvfc: make ibmvfc support FPIN messages Tyrel Datwyler
2026-09-11 5:48 ` [PATCH v10 1/9] scsi: ibmvfc: add basic FPIN support Tyrel Datwyler
2026-09-11 6:00 ` Tyrel Datwyler
2026-09-11 6:06 ` sashiko-bot
2026-09-11 5:48 ` [PATCH v10 2/9] scsi: ibmvfc: add NOOP command support Tyrel Datwyler
2026-09-11 6:00 ` sashiko-bot [this message]
2026-09-11 5:48 ` [PATCH v10 3/9] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Tyrel Datwyler
2026-09-11 6:01 ` sashiko-bot
2026-09-11 5:48 ` [PATCH v10 4/9] scsi: ibmvfc: extend async event handlers for async sub-CRQ events Tyrel Datwyler
2026-09-11 5:48 ` [PATCH v10 5/9] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Tyrel Datwyler
2026-09-11 5:48 ` [PATCH v10 6/9] scsi: ibmvfc: extend channel reg/dereg helpers for async sub-CRQ Tyrel Datwyler
2026-09-11 5:48 ` [PATCH v10 7/9] scsi: ibmvfc: fix IRQ leak and guard deregister on channel reg failure Tyrel Datwyler
2026-09-11 6:03 ` sashiko-bot
2026-09-11 5:48 ` [PATCH v10 8/9] scsi: ibmvfc: register and use asynchronous sub CRQ for events Tyrel Datwyler
2026-09-11 6:02 ` sashiko-bot
2026-09-11 5:48 ` [PATCH v10 9/9] scsi: ibmvfc: handle extended FPIN events Tyrel Datwyler
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=20260911060044.5D8F41F000FF@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.