Skip to content

libcvc: handle missing active port in mixer control - #278

Open
glira wants to merge 1 commit into
linuxmint:masterfrom
glira:libcvc-null-port
Open

glira wants to merge 1 commit into
linuxmint:masterfrom
glira:libcvc-null-port

Conversation

@glira

@glira glira commented Oct 9, 2026 •

Copy link
Copy Markdown

Summary

PipeWire 1.5.84+ can change a stream's port list while BlueZ switches a Bluetooth headset profile (pipewire#5053). gvc_mixer_stream_get_port() was updated to return NULL when the active port is gone (the libgnome-volume-control change that closed #267), but three callers still dereference that pointer:

  • gvc_mixer_control_lookup_device_from_stream
  • gvc_mixer_control_change_output
  • gvc_mixer_control_change_input

gvc_mixer_control_update_sink and update_source already test for NULL. These three do not, so the old g_assert_not_reached() abort becomes a NULL dereference.

How to reproduce

  1. Cinnamon on Ubuntu 26.04 (libcvc 6.4.2-1, or current master with the assert already removed), PipeWire 1.6.2, WirePlumber 0.5.13.
  2. Connect a Bluetooth headset (A2DP).

Both cinnamon and csd-media-keys die at the same time:

csd-media-keys: segfault at 0 in libcvc.so.0.0.0
cinnamon:       segfault at 0 in libcvc.so.0.0.0

On 6.4.2, before the assert was removed, the same event aborts instead:

Cvc:ERROR:../libcvc/gvc-mixer-stream.c:541:gvc_mixer_stream_get_port: code should not be reached

The desktop then tries to fall back to Metacity (cinnamon-launcher), which is not installed on Ubuntu, so the session looks like X died.

Fix

Treat a missing active port like a port change: skip the lookup when port is NULL, and call gvc_mixer_stream_change_port() when active_port is NULL.

Verified locally: three Bluetooth disconnect/connect cycles after the check, same cinnamon PID, no new segfault.

Fixes the remaining crash from #267.

PipeWire 1.5.84 and later can drop a stream's active port while BlueZ
switches a headset profile. gvc_mixer_stream_get_port() now returns
NULL in that case, but three callers still dereference the result.

That turns the old g_assert_not_reached abort into a NULL pointer
dereference in cinnamon and csd-media-keys when a Bluetooth headset
connects. Reproduced on Ubuntu 26.04 with PipeWire 1.6.2: segfault at 0
in libcvc.so.0.

Issue linuxmint#267 removed the assert. These call sites were left unchecked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cinnamon crashes on Bluetooth headset connection (PulseAudio / gvc_mixer_stream_get_port assertion)

1 participant