* [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse
@ 2026-09-15 16:04 Aldo Ariel Panzardo
2026-09-15 16:04 ` [PATCH 2/2] Bluetooth: ISO: release unused CIS holds after channel attach Aldo Ariel Panzardo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Aldo Ariel Panzardo @ 2026-09-15 16:04 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, stable, Aldo Ariel Panzardo
Commit 69997d50ec57 ("Bluetooth: ISO: handle bound CIS cleanup via
hci_conn") made hci_bind_cis() and hci_connect_cis() return a
connection with one hold for the ISO layer. hci_bind_cis() currently
takes that hold only after configuring a CIS, so its BT_CONNECTED and
matching BT_BOUND paths return a bare lookup result. Its configuration
failure path can likewise call hci_conn_drop() before taking a hold.
Take the hold before any state-dependent return or configuration error
so every successful return follows the documented ownership contract
and every error drop is balanced.
hci_connect_cis() also assumes hci_conn_link() always takes a new CIS
hold before dropping the one returned by hci_bind_cis(). However, the
helper returns an existing link without taking another hold. In that
case, preserve the CIS hold for the caller and drop the redundant LE
hold because the existing link already owns its parent hold. Returning
early also avoids changing an existing CIS back to BT_CONNECT.
Fixes: 69997d50ec57 ("Bluetooth: ISO: handle bound CIS cleanup via hci_conn")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
---
net/bluetooth/hci_conn.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b1f911fd4a..827694c3d6 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -2047,6 +2047,8 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst,
cis->conn_timeout = timeout;
}
+ hci_conn_hold(cis);
+
if (cis->state == BT_CONNECTED)
return cis;
@@ -2088,7 +2090,6 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst,
return ERR_PTR(-EINVAL);
}
- hci_conn_hold(cis);
cis->state = BT_BOUND;
return cis;
@@ -2465,6 +2466,12 @@ struct hci_conn *hci_connect_cis(struct hci_dev *hdev, bdaddr_t *dst,
return cis;
}
+ /* The existing link already owns the hold on its parent. */
+ if (cis->link) {
+ hci_conn_drop(le);
+ return cis;
+ }
+
link = hci_conn_link(le, cis);
hci_conn_drop(cis);
if (!link) {
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] Bluetooth: ISO: release unused CIS holds after channel attach
2026-09-15 16:04 [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse Aldo Ariel Panzardo
@ 2026-09-15 16:04 ` Aldo Ariel Panzardo
2026-09-15 17:41 ` [1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse bluez.test.bot
2026-09-16 18:00 ` [PATCH 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Aldo Ariel Panzardo @ 2026-09-15 16:04 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, stable, Aldo Ariel Panzardo
hci_bind_cis() and hci_connect_cis() return one hci_conn hold for the
ISO layer. A new channel association consumes that hold, which is
eventually released by iso_conn_free().
There are two cases where iso_chan_add() does not create an association:
it returns success when the socket is already attached to the same
iso_conn, and it returns -EBUSY when another socket is attached. The
hold returned for the current call is unused in both cases. This occurs
when deferred setup calls iso_connect_cis() again for its existing
socket, or when another socket attempts to reuse the CIS.
Detect the idempotent case while the connection is locked and release
the unused hold after iso_chan_add(). Also release it on -EBUSY. Do not
drop it for other errors: a newly allocated iso_conn releases the
transferred hold when its last temporary reference is put.
Fixes: 69997d50ec57 ("Bluetooth: ISO: handle bound CIS cleanup via hci_conn")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
---
net/bluetooth/iso.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index a461c8a4ef..329bee9c2e 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -496,6 +496,7 @@ static int iso_connect_cis(struct sock *sk)
struct hci_dev *hdev;
bdaddr_t src, dst;
u8 src_type;
+ bool already_attached;
int err;
lock_sock(sk);
@@ -568,8 +569,14 @@ static int iso_connect_cis(struct sock *sk)
goto unlock;
}
+ iso_conn_lock(conn);
+ already_attached = iso_pi(sk)->conn == conn && conn->sk == sk;
+ iso_conn_unlock(conn);
+
err = iso_chan_add(conn, sk, NULL);
iso_conn_put(conn);
+ if (already_attached || err == -EBUSY)
+ hci_conn_drop(hcon);
if (err)
goto unlock;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse
2026-09-15 16:04 [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse Aldo Ariel Panzardo
2026-09-15 16:04 ` [PATCH 2/2] Bluetooth: ISO: release unused CIS holds after channel attach Aldo Ariel Panzardo
@ 2026-09-15 17:41 ` bluez.test.bot
2026-09-16 18:00 ` [PATCH 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-09-15 17:41 UTC (permalink / raw)
To: linux-bluetooth, qwe.aldo
[-- Attachment #1: Type: text/plain, Size: 3111 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/1165738/
---Test result---
Test Summary:
CheckPatch PASS 1.02 seconds
VerifyFixes PASS 0.08 seconds
VerifySignedoff PASS 0.08 seconds
GitLint PASS 0.43 seconds
SubjectPrefix PASS 0.14 seconds
BuildKernel PASS 22.14 seconds
CheckAllWarning PASS 26.92 seconds
CheckSparse PASS 28.93 seconds
BuildKernel32 PASS 22.40 seconds
CheckKernelLLVM PASS 24.14 seconds
TestRunnerSetup PASS 579.01 seconds
TestRunner_l2cap-tester FAIL 8.98 seconds
TestRunner_iso-tester FAIL 6.17 seconds
TestRunner_bnep-tester FAIL 6.33 seconds
TestRunner_mgmt-tester FAIL 6.17 seconds
TestRunner_rfcomm-tester FAIL 6.04 seconds
TestRunner_sco-tester FAIL 6.29 seconds
TestRunner_ioctl-tester FAIL 6.02 seconds
TestRunner_mesh-tester FAIL 6.24 seconds
TestRunner_smp-tester FAIL 6.40 seconds
TestRunner_userchan-tester FAIL 6.13 seconds
TestRunner_6lowpan-tester FAIL 6.21 seconds
IncrementalBuild PASS 24.23 seconds
Details
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_bnep-tester - FAIL
Desc: Run bnep-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_rfcomm-tester - FAIL
Desc: Run rfcomm-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_ioctl-tester - FAIL
Desc: Run ioctl-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_smp-tester - FAIL
Desc: Run smp-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_userchan-tester - FAIL
Desc: Run userchan-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_6lowpan-tester - FAIL
Desc: Run 6lowpan-tester with test-runner
Output:
No test result found
https://github.com/bluez/bluetooth-next/pull/778
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse
2026-09-15 16:04 [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse Aldo Ariel Panzardo
2026-09-15 16:04 ` [PATCH 2/2] Bluetooth: ISO: release unused CIS holds after channel attach Aldo Ariel Panzardo
2026-09-15 17:41 ` [1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse bluez.test.bot
@ 2026-09-16 18:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-16 18:00 UTC (permalink / raw)
To: Aldo Ariel Panzardo; +Cc: luiz.dentz, linux-bluetooth, linux-kernel, stable
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 15 Sep 2026 13:04:29 -0300 you wrote:
> Commit 69997d50ec57 ("Bluetooth: ISO: handle bound CIS cleanup via
> hci_conn") made hci_bind_cis() and hci_connect_cis() return a
> connection with one hold for the ISO layer. hci_bind_cis() currently
> takes that hold only after configuring a CIS, so its BT_CONNECTED and
> matching BT_BOUND paths return a bare lookup result. Its configuration
> failure path can likewise call hci_conn_drop() before taking a hold.
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse
https://git.kernel.org/bluetooth/bluetooth-next/c/e06d549fcd4a
- [2/2] Bluetooth: ISO: release unused CIS holds after channel attach
https://git.kernel.org/bluetooth/bluetooth-next/c/0fcd4dad555c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-16 18:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 16:04 [PATCH 1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse Aldo Ariel Panzardo
2026-09-15 16:04 ` [PATCH 2/2] Bluetooth: ISO: release unused CIS holds after channel attach Aldo Ariel Panzardo
2026-09-15 17:41 ` [1/2] Bluetooth: hci_conn: fix CIS hold ownership on reuse bluez.test.bot
2026-09-16 18:00 ` [PATCH 1/2] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox