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 1F3F8446B4 for ; Tue, 21 May 2024 15:38:05 +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=1716305885; cv=none; b=aYdmJRMu8wRuAKYyOZgEo74ElKJFGgOkyg61ZF1MomecxRoUvPXPxGQqEwYVHD4o1OHTe88NZQJKaZaAskcs8zauuuW0a6TB16OrqaaR7PXJkievSgLRh70L9ItoX8oqkWQ/HBPKOaOr7lfAXoPoWMM1qMSXTKa2t27KT4TVo3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716305885; c=relaxed/simple; bh=tTJ2JPeClAcAtgf8HB/7olUhhu75qAPfkANPgCTNFqc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=W75EEhTSKBB6RXk8SgbfLtIy3ZeDn+3L3oVOeTtvBkrZFCl1xlRLCTEp9PKUV9+JstPhWQH0zr8urD51q0scFHIgzUHNeKhRphydo50W0h54hEFOxeUD9Dr0oeS1OQ11pyCM+QH0+Pia8hZEjBDoIQ0rB7NMlZUP14duRd4n7ZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GHpFkctQ; 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="GHpFkctQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 909F8C2BD11; Tue, 21 May 2024 15:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716305885; bh=tTJ2JPeClAcAtgf8HB/7olUhhu75qAPfkANPgCTNFqc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=GHpFkctQA1IttxZ/qmr56wpAjRVq59bCDjq4EK3eEbC1QsXBjmzfCUt0Lg6Rmg77b WJbsHrOjaMPJy1H56b9i+awzRqU8zjWKYieol2NBCKssr4gsMFWQevIMiRus0EPwr/ Zs1VFypntGUAqPP3MWPK/U2k2MK3BRhPFE3Z8D5E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-52808: scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs Date: Tue, 21 May 2024 17:31:44 +0200 Message-ID: <2024052101-CVE-2023-52808-b457@gregkh> X-Mailer: git-send-email 2.45.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=4445; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=tTJ2JPeClAcAtgf8HB/7olUhhu75qAPfkANPgCTNFqc=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk++0z9kqfWx7ivkU9fVGr+V3qHmK9HYUxYWsTNNn15T Q5uzr0dsSwMgkwMsmKKLF+28RzdX3FI0cvQ9jTMHFYmkCEMXJwCMJE+RoZ5di4vu6Kep8dFaOtG 1766LHR0glMew/z6xdtVO9al7b8eaLv72GLpJyvertsBAA== 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: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs If init debugfs failed during device registration due to memory allocation failure, debugfs_remove_recursive() is called, after which debugfs_dir is not set to NULL. debugfs_remove_recursive() will be called again during device removal. As a result, illegal pointer is accessed. [ 1665.467244] hisi_sas_v3_hw 0000:b4:02.0: failed to init debugfs! ... [ 1669.836708] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0 [ 1669.872669] pc : down_write+0x24/0x70 [ 1669.876315] lr : down_write+0x1c/0x70 [ 1669.879961] sp : ffff000036f53a30 [ 1669.883260] x29: ffff000036f53a30 x28: ffffa027c31549f8 [ 1669.888547] x27: ffffa027c3140000 x26: 0000000000000000 [ 1669.893834] x25: ffffa027bf37c270 x24: ffffa027bf37c270 [ 1669.899122] x23: ffff0000095406b8 x22: ffff0000095406a8 [ 1669.904408] x21: 0000000000000000 x20: ffffa027bf37c310 [ 1669.909695] x19: 00000000000000a0 x18: ffff8027dcd86f10 [ 1669.914982] x17: 0000000000000000 x16: 0000000000000000 [ 1669.920268] x15: 0000000000000000 x14: ffffa0274014f870 [ 1669.925555] x13: 0000000000000040 x12: 0000000000000228 [ 1669.930842] x11: 0000000000000020 x10: 0000000000000bb0 [ 1669.936129] x9 : ffff000036f537f0 x8 : ffff80273088ca10 [ 1669.941416] x7 : 000000000000001d x6 : 00000000ffffffff [ 1669.946702] x5 : ffff000008a36310 x4 : ffff80273088be00 [ 1669.951989] x3 : ffff000009513e90 x2 : 0000000000000000 [ 1669.957276] x1 : 00000000000000a0 x0 : ffffffff00000001 [ 1669.962563] Call trace: [ 1669.965000] down_write+0x24/0x70 [ 1669.968301] debugfs_remove_recursive+0x5c/0x1b0 [ 1669.972905] hisi_sas_debugfs_exit+0x24/0x30 [hisi_sas_main] [ 1669.978541] hisi_sas_v3_remove+0x130/0x150 [hisi_sas_v3_hw] [ 1669.984175] pci_device_remove+0x48/0xd8 [ 1669.988082] device_release_driver_internal+0x1b4/0x250 [ 1669.993282] device_release_driver+0x28/0x38 [ 1669.997534] pci_stop_bus_device+0x84/0xb8 [ 1670.001611] pci_stop_and_remove_bus_device_locked+0x24/0x40 [ 1670.007244] remove_store+0xfc/0x140 [ 1670.010802] dev_attr_store+0x44/0x60 [ 1670.014448] sysfs_kf_write+0x58/0x80 [ 1670.018095] kernfs_fop_write+0xe8/0x1f0 [ 1670.022000] __vfs_write+0x60/0x190 [ 1670.025472] vfs_write+0xac/0x1c0 [ 1670.028771] ksys_write+0x6c/0xd8 [ 1670.032071] __arm64_sys_write+0x24/0x30 [ 1670.035977] el0_svc_common+0x78/0x130 [ 1670.039710] el0_svc_handler+0x38/0x78 [ 1670.043442] el0_svc+0x8/0xc To fix this, set debugfs_dir to NULL after debugfs_remove_recursive(). The Linux kernel CVE team has assigned CVE-2023-52808 to this issue. Affected and fixed versions =========================== Fixed in 5.15.140 with commit f0bfc8a5561f Fixed in 6.1.64 with commit 33331b265aac Fixed in 6.5.13 with commit 75a2656260fe Fixed in 6.6.3 with commit b4465009e7d6 Fixed in 6.7 with commit 6de426f9276c 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-2023-52808 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/hisi_sas/hisi_sas_v3_hw.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/f0bfc8a5561fb0b2c48183dcbfe00bdd6d973bd3 https://git.kernel.org/stable/c/33331b265aac9441ac0c1a5442e3f05d038240ec https://git.kernel.org/stable/c/75a2656260fe8c7eeabda6ff4600b29e183f48db https://git.kernel.org/stable/c/b4465009e7d60c6111946db4c8f1e50d401ed7be https://git.kernel.org/stable/c/6de426f9276c448e2db7238911c97fb157cb23be