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 9CD1C28FA84 for ; Wed, 18 Jun 2025 11:13: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=1750245228; cv=none; b=cKzLk3Mr24nCpNEOxqVxI2X/fCcHM0jsJ3FKj0llBV1m0lBLDJjeMRCqSt5MPuQFQWq+l4m4GpYIZwLzfngbtwgLlTjtkHp5fnyqnI09Axjrjp+1eFOsHA16ouzDdWFQZIQsABo0mK45zSmHl9RrXYO7/Q4QoY1UTiQxspxIXx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750245228; c=relaxed/simple; bh=S5ACgjLvLmMxkBM2tnYBFH4uB8J9UtDId25xHsCSiK0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bF/oAcnwW5SReHEpMEmMY+hlZ1u3ARVW84+GZ7PnA51BcIy++WYu9NZ6f3o4NYg+M4+jpV9Xk2aosy5msA3auI6aVx5ny4iq+E7dGSfp+QNEjhOslvgutiJSxbyIOWbKtP7LPfrYosf+lVLy5i0xSHUZvg2oPzQc8ycSkALHq1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KGd8BRC0; 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="KGd8BRC0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C131C4CEE7; Wed, 18 Jun 2025 11:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750245228; bh=S5ACgjLvLmMxkBM2tnYBFH4uB8J9UtDId25xHsCSiK0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=KGd8BRC03/v5o45RXmKFZX19/q+aZtynLJ0Kvo6QhLsJyvmQhbjeG/vL0iMRy4DaH KYSZrBxhRleAx+7LspyfIu6QrismqTyndJkRNZGXD3Cs3hcDyRrpSw3oaHqrCXLaOz 8pEEiCibBADVvu+eBPzkJCI6Fqh4uZy9VUHR0R+E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50166: Bluetooth: When HCI work queue is drained, only queue chained work Date: Wed, 18 Jun 2025 13:03:51 +0200 Message-ID: <2025061827-CVE-2022-50166-5ecc@gregkh> X-Mailer: git-send-email 2.49.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=3814; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=LXLMZP5HPiK5g591dRP88mO3Rf/SbcoU/XjkGNaIOXU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc9pZpt+rSzprO2Geu810W6dIkZ6fifZde/g6oxpzm jM69kp1xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwESUbRnmF5Q7xlrPumvhpOuh k5bkUds467YUwzyzd68vsMfZKx6ZxrrpslfYhNylf04BAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: Bluetooth: When HCI work queue is drained, only queue chained work The HCI command, event, and data packet processing workqueue is drained to avoid deadlock in commit 76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting state"). There is another delayed work, which will queue command to this drained workqueue. Which results in the following error report: Bluetooth: hci2: command 0x040f tx timeout WARNING: CPU: 1 PID: 18374 at kernel/workqueue.c:1438 __queue_work+0xdad/0x1140 Workqueue: events hci_cmd_timeout RIP: 0010:__queue_work+0xdad/0x1140 RSP: 0000:ffffc90002cffc60 EFLAGS: 00010093 RAX: 0000000000000000 RBX: ffff8880b9d3ec00 RCX: 0000000000000000 RDX: ffff888024ba0000 RSI: ffffffff814e048d RDI: ffff8880b9d3ec08 RBP: 0000000000000008 R08: 0000000000000000 R09: 00000000b9d39700 R10: ffffffff814f73c6 R11: 0000000000000000 R12: ffff88807cce4c60 R13: 0000000000000000 R14: ffff8880796d8800 R15: ffff8880796d8800 FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c0174b4000 CR3: 000000007cae9000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? queue_work_on+0xcb/0x110 ? lockdep_hardirqs_off+0x90/0xd0 queue_work_on+0xee/0x110 process_one_work+0x996/0x1610 ? pwq_dec_nr_in_flight+0x2a0/0x2a0 ? rwlock_bug.part.0+0x90/0x90 ? _raw_spin_lock_irq+0x41/0x50 worker_thread+0x665/0x1080 ? process_one_work+0x1610/0x1610 kthread+0x2e9/0x3a0 ? kthread_complete_and_exit+0x40/0x40 ret_from_fork+0x1f/0x30 To fix this, we can add a new HCI_DRAIN_WQ flag, and don't queue the timeout workqueue while command workqueue is draining. The Linux kernel CVE team has assigned CVE-2022-50166 to this issue. Affected and fixed versions =========================== Issue introduced in 3.19 with commit 76727c02c1e14a2b561b806fa1d08acc1619ad27 and fixed in 5.18.18 with commit 4bf367fa1fefabdf14938d0ac9ed60020389112e Issue introduced in 3.19 with commit 76727c02c1e14a2b561b806fa1d08acc1619ad27 and fixed in 5.19.2 with commit 3b382555706558f5c0587862b6dc03e96a252bba Issue introduced in 3.19 with commit 76727c02c1e14a2b561b806fa1d08acc1619ad27 and fixed in 6.0 with commit 877afadad2dce8aae1f2aad8ce47e072d4f6165e 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-50166 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: include/net/bluetooth/hci.h net/bluetooth/hci_core.c net/bluetooth/hci_event.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/4bf367fa1fefabdf14938d0ac9ed60020389112e https://git.kernel.org/stable/c/3b382555706558f5c0587862b6dc03e96a252bba https://git.kernel.org/stable/c/877afadad2dce8aae1f2aad8ce47e072d4f6165e