* [PATCH 6.1.y] Bluetooth: ISO: drop unbalanced sock_put() in iso_conn_ready()
@ 2026-11-02 12:34 Andrey Misiurov
2026-11-03 14:51 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Misiurov @ 2026-11-02 12:34 UTC (permalink / raw)
To: stable
Cc: gregkh, sashal, luiz.dentz, luiz.von.dentz, marcel, johan.hedberg,
linux-bluetooth, 2122295973, Andrey Misiurov
Commit 1702f12cf59a ("Bluetooth: ISO: fix use-after-free of listener
socket in iso_conn_ready"), the 6.1.y backport of upstream 560bef609fa5,
puts the listener when it is no longer listening. Upstream that put
balances the reference taken by iso_get_sock(). On 6.1.y
iso_get_sock_listen() takes no reference (it got one only in v6.8 with
fa224d0c094a), and no other exit of iso_conn_ready() puts the parent.
No race is needed to hit it: shutdown() of a bound socket sets
SOCK_ZAPPED and keeps BT_BOUND, so listen() still succeeds and the
listener stays BT_LISTEN with SOCK_ZAPPED. Every incoming connection
then takes the new branch, and the second one frees the listener while
it is still on iso_sk_list and attached to its file.
Drop the put.
Found while reviewing a backport of this fix; not reproduced at
runtime.
Fixes: 1702f12cf59a ("Bluetooth: ISO: fix use-after-free of listener socket in iso_conn_ready")
Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
---
6.1.y only: 6.6.y and later have the reference-taking lookup.
The closed-listener race that 560bef609fa5 fixes does not free the
listener on 6.1.y: iso_sock_release() calls sock_orphan() before
iso_sock_kill(), which then returns early on SOCK_DEAD, so a released
ISO socket is never freed (fixed upstream by ce57442a3792 "Bluetooth:
ISO: fix leaking sk after socket release", not in 6.1.y). If that
commit is backported, iso_get_sock_listen() needs to take a reference
as upstream does.
net/bluetooth/iso.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -1536,7 +1536,6 @@ static void iso_conn_ready(struct iso_conn *conn)
if (parent->sk_state != BT_LISTEN ||
sock_flag(parent, SOCK_ZAPPED)) {
release_sock(parent);
- sock_put(parent);
return;
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 6.1.y] Bluetooth: ISO: drop unbalanced sock_put() in iso_conn_ready()
2026-11-02 12:34 [PATCH 6.1.y] Bluetooth: ISO: drop unbalanced sock_put() in iso_conn_ready() Andrey Misiurov
@ 2026-11-03 14:51 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-03 14:51 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, gregkh, luiz.dentz, luiz.von.dentz, marcel,
johan.hedberg, linux-bluetooth, 2122295973, Andrey Misiurov
> Commit 1702f12cf59a ("Bluetooth: ISO: fix use-after-free of listener
> socket in iso_conn_ready"), the 6.1.y backport of upstream 560bef609fa5,
> puts the listener when it is no longer listening.
Queued for 6.1, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02 12:34 [PATCH 6.1.y] Bluetooth: ISO: drop unbalanced sock_put() in iso_conn_ready() Andrey Misiurov
2026-11-03 14:51 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox