Skip to content

Commit 95fe796

Browse files
Yang Ligregkh
authored andcommitted
Bluetooth: hci_event: Disconnect device when BIG sync is lost
[ Upstream commit 55b9551 ] When a BIG sync is lost, the device should be set to "disconnected". This ensures symmetry with the ISO path setup, where the device is marked as "connected" once the path is established. Without this change, the device state remains inconsistent and may lead to a memory leak. Fixes: b2a5f2e ("Bluetooth: hci_event: Add support for handling LE BIG Sync Lost event") Signed-off-by: Yang Li <yang.li@amlogic.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b211e69 commit 95fe796

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

net/bluetooth/hci_event.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7019,6 +7019,7 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data,
70197019
{
70207020
struct hci_evt_le_big_sync_lost *ev = data;
70217021
struct hci_conn *bis, *conn;
7022+
bool mgmt_conn;
70227023

70237024
bt_dev_dbg(hdev, "big handle 0x%2.2x", ev->handle);
70247025

@@ -7037,6 +7038,10 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data,
70377038
while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle,
70387039
BT_CONNECTED,
70397040
HCI_ROLE_SLAVE))) {
7041+
mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &bis->flags);
7042+
mgmt_device_disconnected(hdev, &bis->dst, bis->type, bis->dst_type,
7043+
ev->reason, mgmt_conn);
7044+
70407045
clear_bit(HCI_CONN_BIG_SYNC, &bis->flags);
70417046
hci_disconn_cfm(bis, ev->reason);
70427047
hci_conn_del(bis);

net/bluetooth/mgmt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9705,7 +9705,9 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
97059705
if (!mgmt_connected)
97069706
return;
97079707

9708-
if (link_type != ACL_LINK && link_type != LE_LINK)
9708+
if (link_type != ACL_LINK &&
9709+
link_type != LE_LINK &&
9710+
link_type != BIS_LINK)
97099711
return;
97109712

97119713
bacpy(&ev.addr.bdaddr, bdaddr);

0 commit comments

Comments
 (0)