From: Yang Li via B4 Relay <devnull+yang.li.amlogic.com@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Yang Li <yang.li@amlogic.com>
Subject: [PATCH v4] Bluetooth: iso: fix socket matching ambiguity between BIS and CIS
Date: Mon, 27 Oct 2025 14:10:02 +0800 [thread overview]
Message-ID: <20251027-bis_cis_coexist-v4-1-81c4e890fa6d@amlogic.com> (raw)
From: Yang Li <yang.li@amlogic.com>
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>
---
Changes in v4:
- Rebase code.
- Link to v3: https://lore.kernel.org/r/20250731-bis_cis_coexist-v3-1-1f9bd60ef712@amlogic.com
---
net/bluetooth/iso.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index aa63c8955a53..74ec7d125c88 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:
---
base-commit: f63037a3f252522504774c98960282fb776ef3ca
change-id: 20250731-bis_cis_coexist-717a442d5c42
Best regards,
--
Yang Li <yang.li@amlogic.com>
next reply other threads:[~2025-10-27 6:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 6:10 Yang Li via B4 Relay [this message]
2025-10-27 6:44 ` [v4] Bluetooth: iso: fix socket matching ambiguity between BIS and CIS bluez.test.bot
2025-10-28 21:30 ` [PATCH v4] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251027-bis_cis_coexist-v4-1-81c4e890fa6d@amlogic.com \
--to=devnull+yang.li.amlogic.com@kernel.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=yang.li@amlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).