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 v19 12/13] scsi: ibmvfc: register and use asynchronous sub CRQ for events
Date: Tue, 24 Nov 2026 16:43:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-231582@kernel.org> (raw)
In-Reply-To: <20261124-ibmvfc-fpin-support-v19-12-2aaffe5fe7d2@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] scsi: ibmvfc: skipped async vios_cookie setup in
  ibmvfc_channel_setup_done()
--

commit 3e247869161ac30df00b0fd2f408f7ef73973ecb
Author: Dave Marquardt <davemarq@linux.ibm.com>

scsi: ibmvfc: register and use asynchronous sub CRQ for events

This commit wires the asynchronous sub-CRQ into the ibmvfc channel allocation,
registration, setup, and teardown lifecycle, and advertises async sub-CRQ
support during NPIV login when multi-queue channels are enabled.

> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
> index 5e8b25673ff5d..f478f10f93ffc 100644
> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c

[ ... ]

> @@ -5912,6 +5940,7 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>  {
>  	struct ibmvfc_host *vhost = evt->vhost;
>  	struct ibmvfc_channel_setup *setup = vhost->channel_setup_buf;
> +	struct ibmvfc_channels *async = &vhost->async_scrqs;
>  	struct ibmvfc_channels *scsi = &vhost->scsi_scrqs;
>  	struct ibmvfc_channels *nvme = &vhost->nvme_scrqs;
>  	u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status);
> @@ -5925,8 +5954,12 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>  		ibmvfc_dbg(vhost, "Channel Setup succeeded\n");
>  		flags = be32_to_cpu(setup->flags);
>  		vhost->do_enquiry = 0;
> -		scsi->active_queues = be32_to_cpu(setup->num_scsi_subq_channels);
> -		nvme->active_queues = be32_to_cpu(setup->num_nvme_subq_channels);
> +		scsi->active_queues = min(be32_to_cpu(setup->num_scsi_subq_channels),
> +					  scsi->max_queues);
> +		nvme->active_queues = nvme->scrqs ?
> +			min(be32_to_cpu(setup->num_nvme_subq_channels),
> +			    nvme->max_queues) : 0;
> +		async->active_queues = (async->scrqs && setup->async_sub_crq_handle) ? 1 : 0;
>  
>  		if (flags & IBMVFC_CHANNELS_CANCELED) {
>  			ibmvfc_dbg(vhost, "Channels Canceled\n");
> @@ -5942,6 +5975,8 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>  		for (i = 0; i < nvme->active_queues; i++)
>  			nvme->scrqs[i].vios_cookie =
>  				be64_to_cpu(setup->channel_handles[scsi->active_queues + i]);
> +		for (i = 0; i < async->active_queues; i++)
> +			async->scrqs[i].vios_cookie = be64_to_cpu(setup->async_sub_crq_handle);

[Severity: Medium]
Does breaking out on IBMVFC_CHANNELS_CANCELED skip setting
async->scrqs[0].vios_cookie while leaving async->active_queues set to 1?

When scsi_channels and nvme_channels are both 0, ibmvfc_channel_setup()
sets IBMVFC_CANCEL_CHANNELS and still populates
setup_buf->async_sub_crq_handle so the async sub-CRQ can be used.
However, when the response returns with IBMVFC_CHANNELS_CANCELED set, the
break in ibmvfc_channel_setup_done() jumps over the loop that stores
setup->async_sub_crq_handle in async->scrqs[0].vios_cookie, leaving
vios_cookie uninitialized or stale.  It also leaves scsi->active_queues
and nvme->active_queues unzeroed if the response contains non-zero counts.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-ibmvfc-fpin-support-v19-0-2aaffe5fe7d2@linux.ibm.com?part=12

  reply	other threads:[~2026-11-24 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 16:16 [PATCH v19 00/13] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 01/13] scsi: ibmvfc: fix IRQ leak and guard deregister on channel reg failure Dave Marquardt via B4 Relay
2026-11-24 16:27   ` sashiko-bot
2026-11-24 16:16 ` [PATCH v19 02/13] scsi: ibmvfc: fix potential clobbering of rc after failed irq setup Dave Marquardt via B4 Relay
2026-11-24 16:27   ` sashiko-bot
2026-11-24 16:16 ` [PATCH v19 03/13] scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 04/13] scsi: ibmvfc: fix stale rc and IRQ mapping leak in ibmvfc_register_channel() Dave Marquardt via B4 Relay
2026-11-24 16:21   ` sashiko-bot
2026-11-24 16:16 ` [PATCH v19 05/13] scsi: ibmvfc: fix resource leaks on partial queue allocation failure Dave Marquardt via B4 Relay
2026-11-24 16:27   ` sashiko-bot
2026-11-24 16:16 ` [PATCH v19 06/13] scsi: ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 07/13] scsi: ibmvfc: add NOOP command support Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 08/13] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 09/13] scsi: ibmvfc: extend async event handlers for async sub-CRQ events Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 10/13] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 11/13] scsi: ibmvfc: extend channel registration for async sub-CRQ Dave Marquardt via B4 Relay
2026-11-24 16:16 ` [PATCH v19 12/13] scsi: ibmvfc: register and use asynchronous sub CRQ for events Dave Marquardt via B4 Relay
2026-11-24 16:43   ` sashiko-bot [this message]
2026-11-24 16:16 ` [PATCH v19 13/13] scsi: ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay

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=sashiko-outbox-231582@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