Skip to content

Commit 56f765c

Browse files
Yang LiVudentz
authored andcommitted
Bluetooth: iso: fix socket matching ambiguity between BIS and CIS
When both BIS and CIS links exist, their sockets are in the BT_LISTEN state. dump sock: sk 000000001977ef51 state 6 src 10:a5:62:31:05:cf dst 00:00:00:00:00:00 sk 0000000031d28700 state 7 src 10:a5:62:31:05:cf dst00:00:00:00:00:00 sk 00000000613af00e state 4 # listen sock of bis src 10:a5:62:31:05:cf dst 54:00:00:d4:99:30 sk 000000001710468c state 9 src 10:a5:62:31:05:cf dst 54:00:00:d4:99:30 sk 000000005d97dfde state 4 #listen sock of cis src 10:a5:62:31:05:cf dst 00:00:00:00:00:00 To locate the CIS socket correctly, check both the BT_LISTEN state and whether dst addr is BDADDR_ANY. Link: bluez/bluez#1224 Signed-off-by: Yang Li <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 027473e commit 56f765c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/bluetooth/iso.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,11 @@ static bool iso_match_pa_sync_flag(struct sock *sk, void *data)
20212021
return test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags);
20222022
}
20232023

2024+
static bool iso_match_dst(struct sock *sk, void *data)
2025+
{
2026+
return !bacmp(&iso_pi(sk)->dst, (bdaddr_t *)data);
2027+
}
2028+
20242029
static void iso_conn_ready(struct iso_conn *conn)
20252030
{
20262031
struct sock *parent = NULL;
@@ -2105,7 +2110,7 @@ static void iso_conn_ready(struct iso_conn *conn)
21052110

21062111
if (!parent)
21072112
parent = iso_get_sock(hdev, &hcon->src, BDADDR_ANY,
2108-
BT_LISTEN, NULL, NULL);
2113+
BT_LISTEN, iso_match_dst, BDADDR_ANY);
21092114

21102115
if (!parent)
21112116
return;
@@ -2374,7 +2379,7 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)
23742379
}
23752380
} else {
23762381
sk = iso_get_sock(hdev, &hdev->bdaddr, BDADDR_ANY,
2377-
BT_LISTEN, NULL, NULL);
2382+
BT_LISTEN, iso_match_dst, BDADDR_ANY);
23782383
}
23792384

23802385
done:

0 commit comments

Comments
 (0)