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 48FED4F61C for ; Tue, 27 Feb 2024 18:47:48 +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=1709059669; cv=none; b=l4DHNqeUMfpraISca4Dt+BLWnjJMo6YHIr6znBYl11JY9zcMNms+3AIkl7EHDHcFRQfmiCrMqPdJX/LhPADOTOuSaf5qvs4IFzOuKG4qdnN+Z5x3mERvKJdVlY83Wz3n91X6VGEdf2lCdZmY+bnAe7ZSiqn0XshAxV64Z4vkhMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709059669; c=relaxed/simple; bh=BaxdceLDQVDLabS3Psykc4mZXnAIc+HsuKi5rkMCJZ8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rnmdiIWnvRMWzvy6zy0ah5TbKj2EVMdKIy4ketopUwmMdGwtZ2Hp1S7JapKBhumOLTiEmu1gBhJwpJBEXJbQvsjmy8nY9MID6Icdt5++W16kf5jd9DRI1EW5h5NGjuQjm1zRJghkRXNwB2jQUZSl42L0H040xOe5lm2acSsnLdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=friZXGpj; 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="friZXGpj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6503BC43394; Tue, 27 Feb 2024 18:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709059668; bh=BaxdceLDQVDLabS3Psykc4mZXnAIc+HsuKi5rkMCJZ8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=friZXGpj4DQ6HJE6EYUZlvsueLmTPdL0ncB4v8Xf3m1kC6hx2I0Dd0at8cfOg0Lb0 QuQuydtI5oo/RIPyo5Y3ffzTBYq60h9wmHftNjhRnckNE9iI+rN+LnySwgWy35ljy5 viDoYy2roLpBNpoDKCpNyh+tIHcyUKia5i7I0l24= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-46970: bus: mhi: pci_generic: Remove WQ_MEM_RECLAIM flag from state workqueue Date: Tue, 27 Feb 2024 19:47:30 +0100 Message-ID: <2024022720-CVE-2021-46970-de08@gregkh> X-Mailer: git-send-email 2.44.0 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=3517; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=BaxdceLDQVDLabS3Psykc4mZXnAIc+HsuKi5rkMCJZ8=; b=owGbwMvMwCRo6H6F97bub03G02pJDKn39CxkVPZ5f3TqdGD4cXt+5rpji0xd+s1/LdmRVB0et ol9ns2yjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIvxUMC9a+XrtmneP6fkVt 8bUf3E/lMnzZKcwwP/2lf83Rg++rVkyJ2mm/76+RgMojEQA= 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: bus: mhi: pci_generic: Remove WQ_MEM_RECLAIM flag from state workqueue A recent change created a dedicated workqueue for the state-change work with WQ_HIGHPRI (no strong reason for that) and WQ_MEM_RECLAIM flags, but the state-change work (mhi_pm_st_worker) does not guarantee forward progress under memory pressure, and will even wait on various memory allocations when e.g. creating devices, loading firmware, etc... The work is then not part of a memory reclaim path... Moreover, this causes a warning in check_flush_dependency() since we end up in code that flushes a non-reclaim workqueue: [ 40.969601] workqueue: WQ_MEM_RECLAIM mhi_hiprio_wq:mhi_pm_st_worker [mhi] is flushing !WQ_MEM_RECLAIM events_highpri:flush_backlog [ 40.969612] WARNING: CPU: 4 PID: 158 at kernel/workqueue.c:2607 check_flush_dependency+0x11c/0x140 [ 40.969733] Call Trace: [ 40.969740] __flush_work+0x97/0x1d0 [ 40.969745] ? wake_up_process+0x15/0x20 [ 40.969749] ? insert_work+0x70/0x80 [ 40.969750] ? __queue_work+0x14a/0x3e0 [ 40.969753] flush_work+0x10/0x20 [ 40.969756] rollback_registered_many+0x1c9/0x510 [ 40.969759] unregister_netdevice_queue+0x94/0x120 [ 40.969761] unregister_netdev+0x1d/0x30 [ 40.969765] mhi_net_remove+0x1a/0x40 [mhi_net] [ 40.969770] mhi_driver_remove+0x124/0x250 [mhi] [ 40.969776] device_release_driver_internal+0xf0/0x1d0 [ 40.969778] device_release_driver+0x12/0x20 [ 40.969782] bus_remove_device+0xe1/0x150 [ 40.969786] device_del+0x17b/0x3e0 [ 40.969791] mhi_destroy_device+0x9a/0x100 [mhi] [ 40.969796] ? mhi_unmap_single_use_bb+0x50/0x50 [mhi] [ 40.969799] device_for_each_child+0x5e/0xa0 [ 40.969804] mhi_pm_st_worker+0x921/0xf50 [mhi] The Linux kernel CVE team has assigned CVE-2021-46970 to this issue. Affected and fixed versions =========================== Issue introduced in 5.11 with commit 8f7039787687 and fixed in 5.11.20 with commit abd1510c08a1 Issue introduced in 5.11 with commit 8f7039787687 and fixed in 5.12.3 with commit ed541cff35cb Issue introduced in 5.11 with commit 8f7039787687 and fixed in 5.13 with commit 0fccbf0a3b69 Please see https://www.kernel.org or 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-2021-46970 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/bus/mhi/core/init.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/abd1510c08a13c88d24b622a83c82e87ff1d3135 https://git.kernel.org/stable/c/ed541cff35cbdb695f0c98ef506dd7218883fc07 https://git.kernel.org/stable/c/0fccbf0a3b690b162f53b13ed8bc442ea33437dc