From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796072936; b=27Cf1c2N7rBE/09m23XxhyRT7v1k1wc1woNKp+2C2t1I8nAfcXDVrEKKKO5n5xiZzIA1 qPggOLJO2Oxeq03yzkQUTPCYyRahDi5wgdV9bs7YhFuZmqK+B3Rpinv7VjhLVnfjpFe+9 ww9gKhZ0TKBhA9V2Omew5OLtDEvLn7435JhTGqZsNI342DLOiAKMVeWxuA5YBUsPsbL7M fiU/0nVtlcMhqvuBwFrOx+b+8VLbZ5z5QhFoVhdxqyBnB41EleJopTJbX0Qzs/3/M4mv2 cwexPDwJ8VQti9p9SjJp8oluCjeoBYMf5dsfwNnd77Qp7mjixk19cM3b5YWOoZhzcdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796072936; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=DeS8ekbZ7LdGoenHbVnx517DpQsc7b2Cu/rkE+gbiVs=; b=LX/gnR7ALzcInyA7ieIcphI64Y7NNE716l9NRyW1b6RL6IvkzFEZmkxbD1iv5UbABCU4 q+8HFMbzdvxWiuivmaMFfbWY1BH58yCb5TVQDHLxVZ+Hd1BRsjDVRhVhfBcGG9RCp1rN+ KxtYQplfiHUfmY/OKryc0p66jH7VU5DrDQZ3MDa4zGaIOpjOgDPoRZ+oR/4DDUAS/tOUn 8OPyTXh3JlWbFAnHjMCIfLAQ5ll9OMYcG/mjzq5nPT/n0gVhYucxabDhw7TbCpFdgiw0t A5iWzNgjLf4Xk3TlT47ut3bD5WpeYg4sHyfofIYB1DiqaSjYUnM078nGVollsHifLkw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FnWpCdWJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEFE7606A31A for ; Mon, 30 Nov 2026 21:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FnWpCdWJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC4BF1F000C1; Mon, 30 Nov 2026 21:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796072936; bh=DeS8ekbZ7LdGoenHbVnx517DpQsc7b2Cu/rkE+gbiVs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FnWpCdWJ85HgTfeV45Q3zlBBpdoMnGg3qrAF1QUuQO+OV4qXi9ojWwtn6enufLt+W ktrQiRkdbsv2yKc/Vax8K/Oom/Dqh1uUTiS3kvRTCLs9CUMIEh4cxu3lv0TYQoYnLE Gbtw3qlWLj66PqT8FrbQqGhv0c/Xf3QWW1TL4GoKyq1jtYWy3QB+7jwEUlpe9qhH99 ZMncfuRXi1keJw1tbxEJI/GfVLmu4FaT7tvfWGdan6ha8JfiQO5fLNtOew5EKD604A OqBEU/8C4sg5zjfnaFCcVXiBTXflHBttCJmsaoZ7i/OBnyvjwPivPrgN/h7vMPtNLS UF4U5VUaAobtg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v20 03/13] scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation Reply-To: sashiko-reviews@lists.linux.dev To: "Dave Marquardt" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261130-ibmvfc-fpin-support-v20-3-50beb6e4b62a@linux.ibm.com> References: <20261130-ibmvfc-fpin-support-v20-0-50beb6e4b62a@linux.ibm.com> <20261130-ibmvfc-fpin-support-v20-3-50beb6e4b62a@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 21:08:55 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 > scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allo= cation > > 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 =3D 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 =3D=3D 0 and > msgs.handle =3D=3D NULL issues no hypercall, performs no memset, and leav= es > the queue state unchanged. > > Signed-off-by: Dave Marquardt > Signed-off-by: Tyrel Datwyler [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 S= ub-CRQ Channels") Fixes: 72ea7fe0db73 ("scsi: ibmvfc: Allocate/free queue resource only dur= ing probe/remove") --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130-ibmvfc-fpi= n-support-v20-0-50beb6e4b62a@linux.ibm.com?part=3D3