diff options
| author | Yang Li <yang.li@amlogic.com> | 2025-10-27 14:10:02 +0800 |
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2025-12-01 16:00:07 -0500 |
| commit | 56f765ce73b4303ec5d85439ca7ce1bc0736d18b (patch) | |
| tree | f1281f20e206d1dba8e4132b82875d01afe415f2 /net | |
| parent | 027473ef6a83f28cd6b12551d93dfa24662bdcce (diff) | |
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: https://github.com/bluez/bluez/issues/1224
Signed-off-by: Yang Li <yang.li@amlogic.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net')
| -rw-r--r-- | net/bluetooth/iso.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 4bce03c8a8d3..e36d24a9098b 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -2021,6 +2021,11 @@ static bool iso_match_pa_sync_flag(struct sock *sk, void *data) return test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags); } +static bool iso_match_dst(struct sock *sk, void *data) +{ + return !bacmp(&iso_pi(sk)->dst, (bdaddr_t *)data); +} + static void iso_conn_ready(struct iso_conn *conn) { struct sock *parent = NULL; @@ -2105,7 +2110,7 @@ static void iso_conn_ready(struct iso_conn *conn) if (!parent) parent = iso_get_sock(hdev, &hcon->src, BDADDR_ANY, - BT_LISTEN, NULL, NULL); + BT_LISTEN, iso_match_dst, BDADDR_ANY); if (!parent) return; @@ -2374,7 +2379,7 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) } } else { sk = iso_get_sock(hdev, &hdev->bdaddr, BDADDR_ANY, - BT_LISTEN, NULL, NULL); + BT_LISTEN, iso_match_dst, BDADDR_ANY); } done: |