* [PATCH BlueZ v4] avdtp: Fix use-after-free in connection_lost
@ 2026-11-16 9:07 Jinwang Li
2026-11-16 21:48 ` [BlueZ,v4] " bluez.test.bot
2026-11-18 19:20 ` [PATCH BlueZ v4] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Jinwang Li @ 2026-11-16 9:07 UTC (permalink / raw)
To: linux-bluetooth
Cc: cheng.jiang, wei.deng, shuai.zhang, jinwang.li, xiuzhuo.shang
A sink may start reverse discovery when processing a remote stream
configuration. If the signaling channel disconnects after the stream is
configured and discovery holds the last setup reference, stream cleanup
frees that setup before the pending discovery callback runs, causing a
use-after-free.
Complete discovery with the disconnect error before releasing streams
so the callback runs while its setup is still valid.
Fixes: 02877c5e98b8 ("a2dp: Add reverse discovery")
Assisted-by: Claude:claude-sonnet-5
---
Changes for V4:
- Rebased the patch.
- Add Fixes tag.
- V3 link
https://lore.kernel.org/all/20261104073210.3995738-1-jinwang.li@oss.qualcomm.com/
Changes for V3:
- Update commit message.
- V2 link
https://lore.kernel.org/all/20261016071408.2961576-1-jinwang.li@oss.qualcomm.com/
Changes for V2:
- Rebased the patch.
- V1 link
https://lore.kernel.org/all/20260807095809.2584501-1-jinwang.li@oss.qualcomm.com/
---
profiles/audio/avdtp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 30f80a0c2..5ebc0c5cc 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -1159,11 +1159,11 @@ static void connection_lost(struct avdtp *session, int err)
ba2str(device_get_address(session->device), address);
DBG("Disconnected from %s", address);
+ finalize_discovery(session, err);
+
g_slist_foreach(session->streams, (GFunc) release_stream, session);
session->streams = NULL;
- finalize_discovery(session, err);
-
avdtp_set_state(session, AVDTP_SESSION_STATE_DISCONNECTED);
avdtp_unref(session);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ,v4] avdtp: Fix use-after-free in connection_lost
2026-11-16 9:07 [PATCH BlueZ v4] avdtp: Fix use-after-free in connection_lost Jinwang Li
@ 2026-11-16 21:48 ` bluez.test.bot
2026-11-18 19:20 ` [PATCH BlueZ v4] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-11-16 21:48 UTC (permalink / raw)
To: linux-bluetooth, jinwang.li
[-- Attachment #1: Type: text/plain, Size: 1020 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/1212473/
---Test result---
Test Summary:
CheckPatch PASS 0.27 seconds
GitLint PASS 0.20 seconds
BuildEll PASS 16.49 seconds
BluezMake PASS 238.19 seconds
MakeCheck PASS 2.75 seconds
MakeDistcheck PASS 121.38 seconds
CheckValgrind PASS 124.29 seconds
CheckSmatch PASS 238.10 seconds
bluezmakeextell PASS 77.42 seconds
TestFunctional PASS 1035.17 seconds
IncrementalBuild PASS 241.41 seconds
ScanBuild PASS 868.53 seconds
https://github.com/bluez/bluez/pull/2834
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v4] avdtp: Fix use-after-free in connection_lost
2026-11-16 9:07 [PATCH BlueZ v4] avdtp: Fix use-after-free in connection_lost Jinwang Li
2026-11-16 21:48 ` [BlueZ,v4] " bluez.test.bot
@ 2026-11-18 19:20 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-11-18 19:20 UTC (permalink / raw)
To: Jinwang Li
Cc: linux-bluetooth, cheng.jiang, wei.deng, shuai.zhang,
xiuzhuo.shang
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 16 Nov 2026 17:07:19 +0800 you wrote:
> A sink may start reverse discovery when processing a remote stream
> configuration. If the signaling channel disconnects after the stream is
> configured and discovery holds the last setup reference, stream cleanup
> frees that setup before the pending discovery callback runs, causing a
> use-after-free.
>
> Complete discovery with the disconnect error before releasing streams
> so the callback runs while its setup is still valid.
>
> [...]
Here is the summary with links:
- [BlueZ,v4] avdtp: Fix use-after-free in connection_lost
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=43de1efcb453
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] 3+ messages in thread
end of thread, other threads:[~2026-11-18 19:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 9:07 [PATCH BlueZ v4] avdtp: Fix use-after-free in connection_lost Jinwang Li
2026-11-16 21:48 ` [BlueZ,v4] " bluez.test.bot
2026-11-18 19:20 ` [PATCH BlueZ v4] " 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