Skip to content

Commit 55b9551

Browse files
Yang LiVudentz
authored andcommitted
Bluetooth: hci_event: Disconnect device when BIG sync is lost
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 <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 15bf2c6 commit 55b9551

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
@@ -7024,6 +7024,7 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data,
70247024
{
70257025
struct hci_evt_le_big_sync_lost *ev = data;
70267026
struct hci_conn *bis, *conn;
7027+
bool mgmt_conn;
70277028

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

@@ -7042,6 +7043,10 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data,
70427043
while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle,
70437044
BT_CONNECTED,
70447045
HCI_ROLE_SLAVE))) {
7046+
mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &bis->flags);
7047+
mgmt_device_disconnected(hdev, &bis->dst, bis->type, bis->dst_type,
7048+
ev->reason, mgmt_conn);
7049+
70457050
clear_bit(HCI_CONN_BIG_SYNC, &bis->flags);
70467051
hci_disconn_cfm(bis, ev->reason);
70477052
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)