Subject: CVE-2024-49951: Bluetooth: MGMT: Fix possible crash on mgmt_index_removed

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

Bluetooth: MGMT: Fix possible crash on mgmt_index_removed

If mgmt_index_removed is called while there are commands queued on
cmd_sync it could lead to crashes like the bellow trace:

0x0000053D: __list_del_entry_valid_or_report+0x98/0xdc
0x0000053D: mgmt_pending_remove+0x18/0x58 [bluetooth]
0x0000053E: mgmt_remove_adv_monitor_complete+0x80/0x108 [bluetooth]
0x0000053E: hci_cmd_sync_work+0xbc/0x164 [bluetooth]

So while handling mgmt_index_removed this attempts to dequeue
commands passed as user_data to cmd_sync.

The Linux kernel CVE team has assigned CVE-2024-49951 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.0 with commit 7cf5c2978f23 and fixed in 6.6.55 with commit 4883296505aa
	Issue introduced in 6.0 with commit 7cf5c2978f23 and fixed in 6.10.14 with commit 0cc47233af35
	Issue introduced in 6.0 with commit 7cf5c2978f23 and fixed in 6.11.3 with commit 8c3f7943a291
	Issue introduced in 6.0 with commit 7cf5c2978f23 and fixed in 6.12-rc2 with commit f53e1c9c726d

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-49951
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/4883296505aa7e4863c6869b689afb6005633b23
	https://git.kernel.org/stable/c/0cc47233af35fb5f10b5e6a027cb4ccd480caf9a
	https://git.kernel.org/stable/c/8c3f7943a29145d8a2d8e24893762f7673323eae
	https://git.kernel.org/stable/c/f53e1c9c726d83092167f2226f32bd3b73f26c21