]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Bluetooth: MGMT: Fix not generating command complete for MGMT_OP_DISCONNECT
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 26 Aug 2024 20:14:04 +0000 (16:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:11:33 +0000 (11:11 +0200)
commit249c88e7fb45b6b705040c5af4bd0d0f2bc9735c
tree05cb39610ed52e762ed243f1af9602e3b5db38b1
parentd56412ee7cf9b4ceccb43d8b78ad7ec624357729
Bluetooth: MGMT: Fix not generating command complete for MGMT_OP_DISCONNECT

[ Upstream commit 227a0cdf4a028a73dc256d0f5144b4808d718893 ]

MGMT_OP_DISCONNECT can be called while mgmt_device_connected has not
been called yet, which will cause the connection procedure to be
aborted, so mgmt_device_disconnected shall still respond with command
complete to MGMT_OP_DISCONNECT and just not emit
MGMT_EV_DEVICE_DISCONNECTED since MGMT_EV_DEVICE_CONNECTED was never
sent.

To fix this MGMT_OP_DISCONNECT is changed to work similarly to other
command which do use hci_cmd_sync_queue and then use hci_conn_abort to
disconnect and returns the result, in order for hci_conn_abort to be
used from hci_cmd_sync context it now uses hci_cmd_sync_run_once.

Link: https://github.com/bluez/bluez/issues/932
Fixes: 12d4a3b2ccb3 ("Bluetooth: Move check for MGMT_CONNECTED flag into mgmt.c")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_conn.c
net/bluetooth/mgmt.c