Linux bluetooth development
 help / color / mirror / Atom feed
From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: [PATCH] Bluetooth: ISO: Release BISes left open for rebinding
Date: Sun, 22 Nov 2026 21:13:56 +0100	[thread overview]
Message-ID: <20261122201356.2854729-1-simon.mikuda@streamunlimited.com> (raw)

A BIS socket closed while another socket of the BIG is connected leaves its
connection in BT_OPEN for a rebind, with the hold of the socket. Only an
unbalanced parent drop used to release that hold. Now the first BIS is
never deleted, the BIG isn't terminated and removing the advertising set
fails:

    Bluetooth: hci0: Opcode 0x203c failed: -16

The next broadcast rebinds to the stale BIS and LE Create BIG fails.

Drop the holds of BISes left open when the last socket of the BIG closes.

Fixes: 4c94557dd025 ("Bluetooth: ISO: balance the parent hold in hci_bind_bis()")
Signed-off-by: Simon Mikuda <simon.mikuda@streamunlimited.com>
---
 net/bluetooth/iso.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 06f1e7ba2cb1..e6f0bec7b353 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -907,6 +907,15 @@ static void iso_sock_kill(struct sock *sk)
 	sock_put(sk);
 }
 
+static void iso_drop_open_bis(struct hci_conn *conn, void *data)
+{
+	struct hci_conn *hcon = data;
+
+	if (conn->role == HCI_ROLE_MASTER &&
+	    conn->iso_qos.bcast.big == hcon->iso_qos.bcast.big)
+		hci_conn_drop(conn);
+}
+
 static void iso_sock_disconn(struct sock *sk)
 {
 	struct sock *bis_sk;
@@ -930,6 +939,10 @@ static void iso_sock_disconn(struct sock *sk)
 			sock_put(bis_sk);
 			return;
 		}
+
+		/* Last socket of the BIG, drop the BISes left for rebinding */
+		hci_conn_hash_list_state(hcon->hdev, iso_drop_open_bis,
+					 BIS_LINK, BT_OPEN, hcon);
 	}
 
 	sk->sk_state = BT_DISCONN;

base-commit: 4fe38719e6738feaa90486e36b0790dd5d960a96
-- 
2.43.0


             reply	other threads:[~2026-11-22 20:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 20:13 Simon Mikuda [this message]
2026-11-22 22:45 ` Bluetooth: ISO: Release BISes left open for rebinding bluez.test.bot

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=20261122201356.2854729-1-simon.mikuda@streamunlimited.com \
    --to=simon.mikuda@streamunlimited.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /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