* [PATCH BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free
@ 2025-09-12 18:20 Alex Studer
2025-09-12 19:58 ` [BlueZ] " bluez.test.bot
2025-09-18 13:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Alex Studer @ 2025-09-12 18:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Alex Studer
When an A2DP stream is created in start_ind, a timer is set, suspending
the AVDTP stream if there have been no users within 5 seconds. However,
if the AVDTP stream transitions to the IDLE state before the timer
fires, the A2DP stream is freed without the timer being cleared. This
meant that when the timer fired, it tried to suspend a stream with a
pointer that was previously freed and so segfaulted.
This commit fixes that by ensuring that suspend_timer is cleared before
freeing the A2DP stream.
This was causing random segfaults when connecting my Sony WH-1000XM5
headphones.
Signed-off-by: Alex Studer <alex@studer.dev>
---
profiles/audio/a2dp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 661843a89..4e1362913 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -636,6 +636,11 @@ static void a2dp_stream_free(void *data)
{
struct a2dp_stream *stream = data;
+ if (stream->suspend_timer) {
+ timeout_remove(stream->suspend_timer);
+ stream->suspend_timer = 0;
+ }
+
avdtp_unref(stream->session);
free(stream);
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free
2025-09-12 18:20 [PATCH BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free Alex Studer
@ 2025-09-12 19:58 ` bluez.test.bot
2025-09-18 13:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-09-12 19:58 UTC (permalink / raw)
To: linux-bluetooth, alex
[-- Attachment #1: Type: text/plain, Size: 1262 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/project/bluetooth/list/?series=1001921
---Test result---
Test Summary:
CheckPatch PENDING 0.45 seconds
GitLint PENDING 0.38 seconds
BuildEll PASS 20.02 seconds
BluezMake PASS 2528.19 seconds
MakeCheck PASS 23.40 seconds
MakeDistcheck PASS 184.26 seconds
CheckValgrind PASS 235.56 seconds
CheckSmatch PASS 307.41 seconds
bluezmakeextell PASS 127.93 seconds
IncrementalBuild PENDING 0.33 seconds
ScanBuild PASS 917.66 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free
2025-09-12 18:20 [PATCH BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free Alex Studer
2025-09-12 19:58 ` [BlueZ] " bluez.test.bot
@ 2025-09-18 13:30 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-09-18 13:30 UTC (permalink / raw)
To: Alex Studer; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Fri, 12 Sep 2025 14:20:34 -0400 you wrote:
> When an A2DP stream is created in start_ind, a timer is set, suspending
> the AVDTP stream if there have been no users within 5 seconds. However,
> if the AVDTP stream transitions to the IDLE state before the timer
> fires, the A2DP stream is freed without the timer being cleared. This
> meant that when the timer fired, it tried to suspend a stream with a
> pointer that was previously freed and so segfaulted.
>
> [...]
Here is the summary with links:
- [BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=72b02df3b2b4
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:[~2025-09-18 13:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12 18:20 [PATCH BlueZ] profiles/audio/a2dp: Clear suspend timer on A2DP stream free Alex Studer
2025-09-12 19:58 ` [BlueZ] " bluez.test.bot
2025-09-18 13:30 ` [PATCH BlueZ] " 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