From: Dave Marquardt <davemarq@linux.ibm.com>
To: sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v13 04/11] scsi: ibmvfc: add basic FPIN support
Date: Thu, 08 Oct 2026 16:24:02 -0500 [thread overview]
Message-ID: <87ecdznax9.fsf@linux.ibm.com> (raw)
In-Reply-To: <sashiko-outbox-163317@kernel.org> (sashiko-bot@kernel.org's message of "Wed, 07 Oct 2026 19:41:34 +0000")
sashiko-bot@kernel.org writes:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] scsi: ibmvfc: NULL pointer dereference in queue_work on FPIN event during remove
> --
>
> commit 03a2b80a223e0071e893709993671bdb91c0e958
> Author: Dave Marquardt <davemarq@linux.ibm.com>
>
> scsi: ibmvfc: add basic FPIN support
>
> Implement support for a basic level of Fabric Performance Impact Notifications
> (FPIN) in the ibmvfc driver to enable monitoring of fabric congestion and link
> integrity events. This adds an async event handler for IBMVFC_AE_FPIN events
> that offloads processing to a dedicated workqueue.
>
>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> @@ -3361,11 +3609,25 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
>> case IBMVFC_AE_HALT:
>> ibmvfc_link_down(vhost, IBMVFC_HALTED);
>> break;
>> + case IBMVFC_AE_FPIN:
>> + if (vhost->state == IBMVFC_HOST_OFFLINE)
>> + break;
>> + aw = kzalloc_obj(*aw, GFP_ATOMIC);
>> + if (aw) {
>> + INIT_WORK(&aw->async_work_s, ibmvfc_process_async_work);
>> + aw->vhost = vhost;
>> + aw->crq = *crq;
>> + queue_work(vhost->fpin_workq, &aw->async_work_s);
>
> [Severity: High]
> Does this code risk a NULL pointer dereference or use-after-free during driver
> removal?
>
> During ibmvfc_remove(), vhost->fpin_workq is destroyed and set to NULL before
> the CRQ interrupts are disabled and the tasklet is killed (which occurs later
> in ibmvfc_release_crq_queue()).
>
> If a transport event (IBMVFC_CRQ_XPORT_EVENT) arrives concurrently,
> ibmvfc_handle_crq() unconditionally overwrites vhost->state to IBMVFC_NO_CRQ.
> This erases the IBMVFC_HOST_OFFLINE state set earlier by ibmvfc_remove().
>
> If an IBMVFC_AE_FPIN event is subsequently processed by the still-active
> tasklet, the vhost->state == IBMVFC_HOST_OFFLINE safety check here in
> ibmvfc_handle_async() fails to block it. This causes queue_work() to be
> called with a NULL or already-destroyed fpin_workq pointer.
This problem has been mentioned more than once, and I thought it was
fixed. In thinking about this, I've decided to remove fpin_workq from
struct ibmvfc_host, and queue the work items to a system queue using
schedule_work().
The KUnit tests are another problem, which will be resolved by using
each test using its own work queue rather than the system work queue.
-Dave
next prev parent reply other threads:[~2026-10-08 21:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 19:25 [PATCH v13 00/11] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-10-07 19:25 ` [PATCH v13 01/11] scsi: ibmvfc: fix IRQ leak and guard deregister on channel reg failure Dave Marquardt via B4 Relay
2026-10-07 19:25 ` [PATCH v13 02/11] scsi: ibmvfc: fix potential clobbering of rc after failed irq setup Dave Marquardt via B4 Relay
2026-10-07 19:25 ` [PATCH v13 03/11] scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation Dave Marquardt via B4 Relay
2026-10-07 19:44 ` sashiko-bot
2026-10-09 18:34 ` Dave Marquardt
2026-10-07 19:25 ` [PATCH v13 04/11] scsi: ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-10-07 19:41 ` sashiko-bot
2026-10-08 21:24 ` Dave Marquardt [this message]
2026-10-09 5:20 ` kernel test robot
2026-10-09 14:45 ` Dave Marquardt
2026-10-07 19:25 ` [PATCH v13 05/11] scsi: ibmvfc: add NOOP command support Dave Marquardt via B4 Relay
2026-10-07 19:36 ` sashiko-bot
2026-10-12 19:24 ` Dave Marquardt
2026-10-07 19:25 ` [PATCH v13 06/11] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Dave Marquardt via B4 Relay
2026-10-07 19:25 ` [PATCH v13 07/11] scsi: ibmvfc: extend async event handlers for async sub-CRQ events Dave Marquardt via B4 Relay
2026-10-09 13:22 ` kernel test robot
2026-10-09 14:50 ` Dave Marquardt
2026-10-07 19:25 ` [PATCH v13 08/11] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Dave Marquardt via B4 Relay
2026-10-07 19:44 ` sashiko-bot
2026-10-12 19:44 ` Dave Marquardt
2026-10-07 19:25 ` [PATCH v13 09/11] scsi: ibmvfc: extend channel reg/dereg helpers for async sub-CRQ Dave Marquardt via B4 Relay
2026-10-07 19:25 ` [PATCH v13 10/11] scsi: ibmvfc: register and use asynchronous sub CRQ for events Dave Marquardt via B4 Relay
2026-10-07 19:42 ` sashiko-bot
2026-10-07 19:25 ` [PATCH v13 11/11] scsi: ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay
2026-10-07 19:33 ` sashiko-bot
2026-10-07 19:52 ` Dave Marquardt
2026-10-09 20:29 ` kernel test robot
2026-10-12 19:50 ` 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=87ecdznax9.fsf@linux.ibm.com \
--to=davemarq@linux.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-bot@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