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 B8FB7208D7 for ; Mon, 20 May 2024 09:42:59 +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=1716198179; cv=none; b=Hc0ks0Up5pFwc5hhe4C6KJLpSNEZnDr7hwy6/VJPYugZO/TS+5gN0eohJporSZdABWUgfVmJgZFA9qp9wTgX8JW7KN6j9e6RbNXdI8/alTIzVbJSCuU5ly4unHGaAy6f8fobqdcr4uO6iIc7QtnSVxHDe2iwEuJZGl66bpdaN5E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716198179; c=relaxed/simple; bh=C8NGrAowVzQCwevC03ZDhqfzHUdWQo0KzyS/WRtWMY4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GTZMLxRBGBTViQ1crFeShGbJdKhSGaLnqvL0WnSrfw1LwMa9qkVjtT8+bBV8yKgYRejaIzc9rQ/1ZSys9SYG41YyNam42HKSSYHr+bhMAU/457zSkQBeNVtOsj2JNo8FCFRyPda15A24aVsGD7UwsWBicC699egV5kDnUV7JiAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LpOS/JhB; 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="LpOS/JhB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3DF7C2BD10; Mon, 20 May 2024 09:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716198179; bh=C8NGrAowVzQCwevC03ZDhqfzHUdWQo0KzyS/WRtWMY4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=LpOS/JhBu8VBePOrNp4oG87eBMZ4+nsVLwJUCQ84UPELGX69pdFj4tDmbXQBvVlJ/ e+EAI3Zv5smru2R/RGy3FDqwFahNda6yZXKIb2iSzKDBwp1m1xqSpYh3rc37HLnlVb lx0p8lEM8Ze2KVALwMcE3NwR+bKARAABXcBaR/nI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35968: pds_core: Fix pdsc_check_pci_health function to use work thread Date: Mon, 20 May 2024 11:42:33 +0200 Message-ID: <2024052022-CVE-2024-35968-80ae@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=3564; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=C8NGrAowVzQCwevC03ZDhqfzHUdWQo0KzyS/WRtWMY4=; b=owGbwMvMwCRo6H6F97bub03G02pJDGneUv9mLy6z+VKYmfmpRX2NfsrHnNSnhzsk+hs/TTm1x i/y4p/ujlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIyliGBTvPH3A+x7e71+3L yn/XVDc9YHJTMmKYpx+Yse7ZuoNFLckCWdKOne5CGr9XAgA= 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: pds_core: Fix pdsc_check_pci_health function to use work thread When the driver notices fw_status == 0xff it tries to perform a PCI reset on itself via pci_reset_function() in the context of the driver's health thread. However, pdsc_reset_prepare calls pdsc_stop_health_thread(), which attempts to stop/flush the health thread. This results in a deadlock because the stop/flush will never complete since the driver called pci_reset_function() from the health thread context. Fix by changing the pdsc_check_pci_health_function() to queue a newly introduced pdsc_pci_reset_thread() on the pdsc's work queue. Unloading the driver in the fw_down/dead state uncovered another issue, which can be seen in the following trace: WARNING: CPU: 51 PID: 6914 at kernel/workqueue.c:1450 __queue_work+0x358/0x440 [...] RIP: 0010:__queue_work+0x358/0x440 [...] Call Trace: ? __warn+0x85/0x140 ? __queue_work+0x358/0x440 ? report_bug+0xfc/0x1e0 ? handle_bug+0x3f/0x70 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? __queue_work+0x358/0x440 queue_work_on+0x28/0x30 pdsc_devcmd_locked+0x96/0xe0 [pds_core] pdsc_devcmd_reset+0x71/0xb0 [pds_core] pdsc_teardown+0x51/0xe0 [pds_core] pdsc_remove+0x106/0x200 [pds_core] pci_device_remove+0x37/0xc0 device_release_driver_internal+0xae/0x140 driver_detach+0x48/0x90 bus_remove_driver+0x6d/0xf0 pci_unregister_driver+0x2e/0xa0 pdsc_cleanup_module+0x10/0x780 [pds_core] __x64_sys_delete_module+0x142/0x2b0 ? syscall_trace_enter.isra.18+0x126/0x1a0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7fbd9d03a14b [...] Fix this by preventing the devcmd reset if the FW is not running. The Linux kernel CVE team has assigned CVE-2024-35968 to this issue. Affected and fixed versions =========================== Issue introduced in 6.8 with commit d9407ff11809 and fixed in 6.8.7 with commit 38407914d482 Issue introduced in 6.8 with commit d9407ff11809 and fixed in 6.9 with commit 81665adf25d2 Issue introduced in 6.6.16 with commit bd8740928aac Issue introduced in 6.7.4 with commit 46826a384406 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-2024-35968 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/net/ethernet/amd/pds_core/core.c drivers/net/ethernet/amd/pds_core/core.h drivers/net/ethernet/amd/pds_core/dev.c drivers/net/ethernet/amd/pds_core/main.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/38407914d48273d7f8ab765b9243658afe1c3ab6 https://git.kernel.org/stable/c/81665adf25d28a00a986533f1d3a5df76b79cad9