Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: ISO: Don't drop the hold of a closed BIS socket twice
@ 2026-11-22 20:14 Simon Mikuda
  2026-11-22 22:46 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Mikuda @ 2026-11-22 20:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda, Marcel Holtmann, Luiz Augusto von Dentz

When a broadcast source BIS socket is closed while its BIG is being
created, its hold on the BIS is dropped and its iso_conn is freed. When LE
Setup ISO Data Path of that BIS completes, iso_connect_cfm() creates a new
iso_conn for it, and freeing that iso_conn drops the hold a second time.

The first BIS of a BIG is the parent of the others, so the extra drop
deletes it together with them while the BIG is still running. The sockets
of the other BISes get ECONNRESET, and the BIG is terminated twice. The
controller rejects the second LE Terminate BIG:

    < LE Create Broadcast Isochronous Group  BIG handle: 0x00, 2 BISes
      (BIS 1 socket closed)
    > LE Broadcast Isochronous Group Complete  Connection handles: 16, 17
    < LE Setup Isochronous Data Path  Handle: 16
    < LE Setup Isochronous Data Path  Handle: 17
    < LE Terminate Broadcast Isochronous Group  BIG handle: 0x00
    > LE Broadcast Isochronous Group Terminate  BIG handle: 0x00
    < LE Remove Advertising Set  Handle: 1
    < LE Terminate Broadcast Isochronous Group  BIG handle: 0x00
    > Command Status  Unknown Advertising Identifier (0x42)

Fix this by looking up the iso_conn that a source BIS got in connect()
instead of creating a new one. If it is gone, the socket is closed and
there is nothing to make ready. The lookup takes hcon->proto_lock, as
iso_conn_del() does, because the closing socket frees the iso_conn after
clearing hcon->iso_data under that lock.

Steps to reproduce:
1. Run btmon.
2. Open two broadcast source BIS sockets for one BIG and connect them, the
   first with BT_DEFER_SETUP, as isotest -N 2 does.
3. Close the first socket right away, before LE BIG Complete.
4. The second socket always gets ECONNRESET, and btmon shows LE Terminate
   BIG twice, the second one failing with Unknown Advertising Identifier.

Fixes: fdfde532ab1c ("Bluetooth: ISO: fix refcounting of iso_conn")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/iso.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 06f1e7ba2cb1..fd33a1ec53d6 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2680,7 +2680,14 @@ static void iso_connect_cfm(struct hci_conn *hcon, __u8 status)
 	    test_bit(HCI_CONN_PA_SYNC_FAILED, hcon->flags)) {
 		struct iso_conn *conn;
 
-		conn = iso_conn_add(hcon);
+		if (hcon->type == BIS_LINK && hcon->role == HCI_ROLE_MASTER) {
+			spin_lock(&hcon->proto_lock);
+			conn = iso_conn_hold_unless_zero(hcon->iso_data);
+			spin_unlock(&hcon->proto_lock);
+		} else {
+			conn = iso_conn_add(hcon);
+		}
+
 		if (conn) {
 			iso_conn_ready(conn);
 			iso_conn_put(conn);

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: Bluetooth: ISO: Don't drop the hold of a closed BIS socket twice
  2026-11-22 20:14 [PATCH] Bluetooth: ISO: Don't drop the hold of a closed BIS socket twice Simon Mikuda
@ 2026-11-22 22:46 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-11-22 22:46 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1218954/

---Test result---

Test Summary:
CheckPatch                    PASS      0.62 seconds
VerifyFixes                   PASS      0.11 seconds
VerifySignedoff               PASS      0.10 seconds
GitLint                       PASS      0.28 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      24.14 seconds
CheckAllWarning               PASS      27.11 seconds
CheckSparse                   PASS      29.06 seconds
BuildKernel32                 PASS      23.46 seconds
CheckKernelLLVM               PASS      24.45 seconds
TestRunnerSetup               PASS      557.51 seconds
TestRunner_iso-tester         PASS      14.10 seconds
IncrementalBuild              PASS      23.61 seconds



https://github.com/bluez/bluetooth-next/pull/1199

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-22 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 20:14 [PATCH] Bluetooth: ISO: Don't drop the hold of a closed BIS socket twice Simon Mikuda
2026-11-22 22:46 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox