All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Marquardt <davemarq@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v7 2/8] scsi: ibmvfc: Add NOOP command support
Date: Thu, 03 Sep 2026 10:08:33 -0500	[thread overview]
Message-ID: <87ld9i5q4u.fsf@linux.ibm.com> (raw)
In-Reply-To: <20260831214057.3FA141F000E9@smtp.kernel.org>

sashiko-bot@kernel.org writes:

> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [Medium] The code suppresses logging of unexpected NOOP messages received before NPIV login completes, directly contradicting the commit message claim of logging early messages.
>
> Pre-existing issues:
> - [High] Dereferencing untrusted pointer `evt->queue` before validation in `ibmvfc_handle_scrq` can lead to a kernel panic or out-of-bounds read if the partner sends a malicious or corrupted non-NULL correlation token.
> --
>
> commit a2f1ce40ef9fb5e6c86a16b1ac92eb6c526f0a48
> Author: Dave Marquardt <davemarq@linux.ibm.com>
>
> scsi: ibmvfc: Add NOOP command support
>
> This commit adds support for VFC_NOOP messages from VIOS to enable keep-alive
> functionality between the client and server. It defines the VFC_NOOP CRQ
> format, adds handling in the CRQ handlers, and sets the NPIV login capability
> bit.
>
>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> index 78be00d31a064..e972e4ec5be00 100644
>> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
> [ ... ]
>> @@ -3693,6 +3695,14 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost,
>>  	if (crq->format == IBMVFC_ASYNC_EVENT)
>>  		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;
>> +	}
>> +
>
> [Severity: Medium]
> The commit message states the intent is to "Log unexpected NOOP messages if
> received before VIOS advertises support during NPIV login." Does this
> condition match that intent?

No, this does not match. I will rewrite the commit message to reflect reality.

> In drivers/scsi/ibmvscsi/ibmvfc-core.c:ibmvfc_handle_crq(), the code checks:
> if (vhost->state == IBMVFC_ACTIVE && !ibmvfc_check_caps(...))
>
> By requiring the host state to be IBMVFC_ACTIVE, this appears to suppress
> logging of unexpected NOOP messages received during the IBMVFC_INITIALIZING
> state, and only logs them after NPIV login has completed.
>
>>  	/* 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
> [ ... ]
>> @@ -4223,7 +4233,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: High]
> This isn't a bug introduced by this patch, but can this lead to an
> out-of-bounds read or kernel panic if the VIOS partner sends a corrupted or
> malicious non-NULL correlation token?

We trust the VIOS partner, so I will not update this.

-Dave

  reply	other threads:[~2026-09-03 15:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 19:00 [PATCH v7 0/8] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-08-31 19:00 ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 1/8] scsi: ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 21:30   ` sashiko-bot
2026-09-02 20:29     ` Dave Marquardt
2026-09-02 21:59     ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 2/8] scsi: ibmvfc: Add NOOP command support Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 21:40   ` sashiko-bot
2026-09-03 15:08     ` Dave Marquardt [this message]
2026-08-31 19:00 ` [PATCH v7 3/8] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 4/8] scsi: ibmvfc: extend async event handlers to handle async sub queue events Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 5/8] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 22:18   ` sashiko-bot
2026-09-03 16:18     ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 6/8] scsi: ibmvfc: extend channel registration and deregistration for async subq Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 22:34   ` sashiko-bot
2026-09-03 18:43     ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 7/8] scsi: ibmvfc: register and use asynchronous sub CRQ for events Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 22:46   ` sashiko-bot
2026-09-08 19:52     ` Dave Marquardt
2026-08-31 19:00 ` [PATCH v7 8/8] scsi: ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay
2026-08-31 19:00   ` Dave Marquardt
2026-08-31 22:56   ` sashiko-bot
2026-09-08 19:53     ` Dave Marquardt

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=87ld9i5q4u.fsf@linux.ibm.com \
    --to=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 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.