From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEBB521B910 for ; Wed, 26 Feb 2025 02:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536858; cv=none; b=imwpo9OMg7gpQhFxDuIvFKFxzKZjyIVnJa5eDQWk7v7YN/L2+nwwYe/Xx0HJAuOPSoCy5Q+SbvfdUtWZQHE5PC7iB0zh7AaMqxaJY/4rkx2OLV1dxEsVFDawhZE34tn6al5HPVA3yXN5bytWSEORV+eP/8UPR0TGs9UDOePNREg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536858; c=relaxed/simple; bh=8jw/p6QtA/AdFkEZt0tgjoOBPWtbPAUqcsysgc1nnkU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MgPtX+laEi7xFMe+kMkEXXKnqJuzp1swqefnD5BE+CSbhC0QLVqPEPaJtadh4INl8tv/GEPLP9lxNBeH6lKLQVZMV67/rb3dG5Sx4/uTZMrqonSN8quv5eMtfG0MQPY4lCLiVLgMpRlHPbqR/NzgpThH7w6hfqGVEVJxrsOfPjs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YcPix9Ut; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YcPix9Ut" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C14DDC4CEDD; Wed, 26 Feb 2025 02:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536857; bh=8jw/p6QtA/AdFkEZt0tgjoOBPWtbPAUqcsysgc1nnkU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=YcPix9UtEEr2GBHguzXzR/A1Y/SAmeQPic5c45iH7Eahq9CIuB5fgIBKtXHHNsV61 WbusIPocwJVQ3Gpu4Pzsy9CgCMa33STDTSebVKrW4hCm224sERzWX7IZUTuYUKMzGA O4qMPWibksCkSOyL1nviuwiCWf+5ZMvwKCcGQ0Jk= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49701: scsi: ibmvfc: Allocate/free queue resource only during probe/remove Date: Wed, 26 Feb 2025 03:24:24 +0100 Message-ID: <2025022629-CVE-2022-49701-ed2a@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5437; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=8jw/p6QtA/AdFkEZt0tgjoOBPWtbPAUqcsysgc1nnkU=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7qp4Wc84w7S96whPWHW91cVfT+ksX0iWfhxnb6jziK pFYLy7WEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABPZ+Ydhnvp8n1dGyTFTnopl H96dknm3d9muwwzz7NJ/Wi79ckrjZaF8VJucr/OlJ0eKAQ== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: scsi: ibmvfc: Allocate/free queue resource only during probe/remove Currently, the sub-queues and event pool resources are allocated/freed for every CRQ connection event such as reset and LPM. This exposes the driver to a couple issues. First the inefficiency of freeing and reallocating memory that can simply be resued after being sanitized. Further, a system under memory pressue runs the risk of allocation failures that could result in a crippled driver. Finally, there is a race window where command submission/compeletion can try to pull/return elements from/to an event pool that is being deleted or already has been deleted due to the lack of host state around freeing/allocating resources. The following is an example of list corruption following a live partition migration (LPM): Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: vfat fat isofs cdrom ext4 mbcache jbd2 nft_counter nft_compat nf_tables nfnetlink rpadlpar_io rpaphp xsk_diag nfsv3 nfs_acl nfs lockd grace fscache netfs rfkill bonding tls sunrpc pseries_rng drm drm_panel_orientation_quirks xfs libcrc32c dm_service_time sd_mod t10_pi sg ibmvfc scsi_transport_fc ibmveth vmx_crypto dm_multipath dm_mirror dm_region_hash dm_log dm_mod ipmi_devintf ipmi_msghandler fuse CPU: 0 PID: 2108 Comm: ibmvfc_0 Kdump: loaded Not tainted 5.14.0-70.9.1.el9_0.ppc64le #1 NIP: c0000000007c4bb0 LR: c0000000007c4bac CTR: 00000000005b9a10 REGS: c00000025c10b760 TRAP: 0700 Not tainted (5.14.0-70.9.1.el9_0.ppc64le) MSR: 800000000282b033 CR: 2800028f XER: 0000000f CFAR: c0000000001f55bc IRQMASK: 0 GPR00: c0000000007c4bac c00000025c10ba00 c000000002a47c00 000000000000004e GPR04: c0000031e3006f88 c0000031e308bd00 c00000025c10b768 0000000000000027 GPR08: 0000000000000000 c0000031e3009dc0 00000031e0eb0000 0000000000000000 GPR12: c0000031e2ffffa8 c000000002dd0000 c000000000187108 c00000020fcee2c0 GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 GPR20: 0000000000000000 0000000000000000 0000000000000000 c008000002f81300 GPR24: 5deadbeef0000100 5deadbeef0000122 c000000263ba6910 c00000024cc88000 GPR28: 000000000000003c c0000002430a0000 c0000002430ac300 000000000000c300 NIP [c0000000007c4bb0] __list_del_entry_valid+0x90/0x100 LR [c0000000007c4bac] __list_del_entry_valid+0x8c/0x100 Call Trace: [c00000025c10ba00] [c0000000007c4bac] __list_del_entry_valid+0x8c/0x100 (unreliable) [c00000025c10ba60] [c008000002f42284] ibmvfc_free_queue+0xec/0x210 [ibmvfc] [c00000025c10bb10] [c008000002f4246c] ibmvfc_deregister_scsi_channel+0xc4/0x160 [ibmvfc] [c00000025c10bba0] [c008000002f42580] ibmvfc_release_sub_crqs+0x78/0x130 [ibmvfc] [c00000025c10bc20] [c008000002f4f6cc] ibmvfc_do_work+0x5c4/0xc70 [ibmvfc] [c00000025c10bce0] [c008000002f4fdec] ibmvfc_work+0x74/0x1e8 [ibmvfc] [c00000025c10bda0] [c0000000001872b8] kthread+0x1b8/0x1c0 [c00000025c10be10] [c00000000000cd64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: 40820034 38600001 38210060 4e800020 7c0802a6 7c641b78 3c62fe7a 7d254b78 3863b590 f8010070 4ba309cd 60000000 <0fe00000> 7c0802a6 3c62fe7a 3863b640 ---[ end trace 11a2b65a92f8b66c ]--- ibmvfc 30000003: Send warning. Receive queue closed, will retry. Add registration/deregistration helpers that are called instead during connection resets to sanitize and reconfigure the queues. The Linux kernel CVE team has assigned CVE-2022-49701 to this issue. Affected and fixed versions =========================== Issue introduced in 5.12 with commit 3034ebe26389740bb6b4a463e05afb51dc93c336 and fixed in 5.15.51 with commit 161ec2a0807ddd58bc0f24f3e1e7e3d4fef5297f Issue introduced in 5.12 with commit 3034ebe26389740bb6b4a463e05afb51dc93c336 and fixed in 5.18.8 with commit 9f23c499ca601b2a1e1d2e761d03964b739bca0e Issue introduced in 5.12 with commit 3034ebe26389740bb6b4a463e05afb51dc93c336 and fixed in 5.19 with commit 72ea7fe0db73d65c7d977208842d8ade9b823de9 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49701 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/scsi/ibmvscsi/ibmvfc.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/161ec2a0807ddd58bc0f24f3e1e7e3d4fef5297f https://git.kernel.org/stable/c/9f23c499ca601b2a1e1d2e761d03964b739bca0e https://git.kernel.org/stable/c/72ea7fe0db73d65c7d977208842d8ade9b823de9