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 08DBB31FEF9 for ; Tue, 16 Sep 2025 16:13:11 +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=1758039194; cv=none; b=jx7I1n4f6mqj+c0KnVoSLeXI9dEBFyNzJb0pa3Q6u9N7r14riTCOen2VHMPF16S+Aq5wfU9OO0A+kLRfrZLbon3gevlF15i+sz3osGNi+L30pvutDlIyZdYcQFWuUzUSBpxTk7g5xmHot/1B+dno7B3dJvmk2JOai3WuvEexvt8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758039194; c=relaxed/simple; bh=GQ+hhNtToQU25jO3OaxiRbkrEVx7dRsNq2PSrLnX3JY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OIH8P3Hq8sns7IOa3eCrexBB6U1yhl2u9UQPSywCp7/B3t00fdPRdJvgtieM/fX4SzTwdcVlPxRT2EVvC7aN3eY/knX4abV7ksKwif/7gw+DlKmNxJiuDqaldZscug+nMIwp5AR2XORLaNeCSMl0UEmsjlaL/2+kRLQkCQdA5xo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uXO1tK9c; 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="uXO1tK9c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36087C113CF; Tue, 16 Sep 2025 16:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758039191; bh=GQ+hhNtToQU25jO3OaxiRbkrEVx7dRsNq2PSrLnX3JY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=uXO1tK9cmqR48X3QDlP0erlcfTDCveiVCD96yQVVCw43nqF2/lZuEnTsUYM6qXJo3 zNgrI0eQ9mwsDAr5E4q5BakzTlNb4dId1naVJ4b76/ZQJXHwaqzxYphFoOpFFYUJUs P1vTR7Ho3474xRs7gr6VN/zluY/R0IJr3VgKw/vg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50339: Bluetooth: avoid hci_dev_test_and_set_flag() in mgmt_init_hdev() Date: Tue, 16 Sep 2025 18:11:35 +0200 Message-ID: <2025091636-CVE-2022-50339-bc17@gregkh> X-Mailer: git-send-email 2.51.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=2574; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=/Nv3bh4A+V00O2wmPxl/RADce0nXr0EB/N91zFLTNKM=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkneyyKbn103FBXeziUW2GKqLX8K7FpttH29ayZipo7r Hc/0jLuiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgImkSTPMlVOYNGkV90re05aT 76d1zX5nzdzhDhTlddPbfpPR+t+62l8mFfsf9l88rgkA 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: avoid hci_dev_test_and_set_flag() in mgmt_init_hdev() syzbot is again reporting attempt to cancel uninitialized work at mgmt_index_removed() [1], for setting of HCI_MGMT flag from mgmt_init_hdev() from hci_mgmt_cmd() from hci_sock_sendmsg() can race with testing of HCI_MGMT flag from mgmt_index_removed() from hci_sock_bind() due to lack of serialization via hci_dev_lock(). Since mgmt_init_hdev() is called with mgmt_chan_list_lock held, we can safely split hci_dev_test_and_set_flag() into hci_dev_test_flag() and hci_dev_set_flag(). Thus, in order to close this race, set HCI_MGMT flag after INIT_DELAYED_WORK() completed. This is a local fix based on mgmt_chan_list_lock. Lack of serialization via hci_dev_lock() might be causing different race conditions somewhere else. But a global fix based on hci_dev_lock() should deserve a future patch. The Linux kernel CVE team has assigned CVE-2022-50339 to this issue. Affected and fixed versions =========================== Issue introduced in 6.0 with commit 3f2893d3c142986aa935821460cb3adb77044722 and fixed in 6.0.3 with commit e53c6180db8dd09de94e0a3bdf4fef6f5f9dd6e6 Issue introduced in 6.0 with commit 3f2893d3c142986aa935821460cb3adb77044722 and fixed in 6.1 with commit f74ca25d6d6629ffd4fd80a1a73037253b57d06b 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-50339 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: net/bluetooth/mgmt.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/e53c6180db8dd09de94e0a3bdf4fef6f5f9dd6e6 https://git.kernel.org/stable/c/f74ca25d6d6629ffd4fd80a1a73037253b57d06b