All of lore.kernel.org
 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 v20 03/13] scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation
Date: Mon, 30 Nov 2026 21:08:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-241974@kernel.org> (raw)
In-Reply-To: <20261130-ibmvfc-fpin-support-v20-3-50beb6e4b62a@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] scsi: ibmvfc: missing Fixes trailer on channel deregistration
  fix
--

commit 6a6a081a8ea79753e2cb80ab983eaa4a2d12332a
Author: Tyrel Datwyler <tyreld@linux.ibm.com>

> scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation
>
> Guard ibmvfc_deregister_channel() against calling H_FREE_SUB_CRQ on a
> queue that was never registered and against memsetting a buffer that was
> never allocated.
>
> Add an scrq->cookie guard around the H_FREE_SUB_CRQ hypercall so it is
> only issued when the cookie is non-zero; clear scrq->cookie to zero on
> success to prevent double-free if the function is called again during
> reset or teardown. Add scrq->cookie = 0 in the ibmvfc_register_channel()
> irq_failed: cleanup path for the same reason. Guard the memset() of the
> queue message buffer behind a check of scrq->msgs.handle to prevent a
> NULL dereference when the function is called on a queue that was never
> allocated, such as async_sub_crq when multi-queue is disabled or
> initialization failed before ibmvfc_alloc_queue() was reached. Update the
> error message to include channels->protocol so failures can be
> distinguished across SCSI, NVMe, and async sub-CRQ channels.
>
> Expose ibmvfc_deregister_channel() via VISIBLE_IF_KUNIT and
> EXPORT_SYMBOL_IF_KUNIT and add a kernel-doc header to support KUnit
> testing.
>
> Add ibmvfc_get_first_vhost() to retrieve the first registered ibmvfc
> adapter with a reference held; expose it via VISIBLE_IF_KUNIT and
> EXPORT_SYMBOL_IF_KUNIT for use by KUnit tests.
>
> Add SCSI_IBMVFC_KUNIT_TEST Kconfig entry and Makefile line, and create
> ibmvfc_kunit.c with an ibmvfc-channel-test suite containing
> ibmvfc_deregister_channel_guard_test(). The test verifies that calling
> ibmvfc_deregister_channel() on a queue with cookie == 0 and
> msgs.handle == NULL issues no hypercall, performs no memset, and leaves
> the queue state unchanged.
>
> Signed-off-by: Dave Marquardt <davemarq@linux.ibm.com>
> Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>

[Severity: Low]
This fixes the unguarded H_FREE_SUB_CRQ hypercall and queue buffer
memset() in ibmvfc_deregister_channel().  Should the commit message
include Fixes tags for the commits that introduced them:

  Fixes: 3034ebe26389 ("scsi: ibmvfc: Add alloc/dealloc routines for SCSI Sub-CRQ Channels")
  Fixes: 72ea7fe0db73 ("scsi: ibmvfc: Allocate/free queue resource only during probe/remove")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-ibmvfc-fpin-support-v20-0-50beb6e4b62a@linux.ibm.com?part=3

  reply	other threads:[~2026-11-30 21:08 UTC|newest]

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