pipewire/spa/plugins
Chengyi Zhao 91b10af3b8 alsa-pcm: Guard fflush/fclose on state->log_file with NULL check
When an ALSA device enters an inconsistent state, spa_alsa_clear()
may close log_file but later code paths (e.g., set_swparams) still
call fflush(state->log_file) or fclose(state->log_file). This can
lead to use-after-free or passing NULL to fclose, causing crashes.

Add NULL checks before fflush and fclose, and set log_file to NULL
after closing to prevent subsequent use.

Crash backtrace from an actual occurrence (invalid buf in log_write):

 #0  __GI___strchrnul_lasx
 #1  __GI_strcspn
 #2  log_write (cookie=0x5555667f3f08, buf=0x5555670c4000, size=...)
 #3  _IO_cookie_write
 ...
 #8  set_swparams
 #9  do_prepare
 #10 alsa_recover
2026-04-30 16:13:05 +08:00
..
aec spa: aec: Add some channel config validation 2026-03-17 12:06:25 +00:00
alsa alsa-pcm: Guard fflush/fclose on state->log_file with NULL check 2026-04-30 16:13:05 +08:00
audioconvert channelmix: add SEE 7p1 to stereo downmix 2026-04-27 15:59:38 +02:00
audiomixer audiomixer: rate limit the "out of buffers" debug 2026-04-28 10:34:39 +02:00
audiotestsrc spa: do not use SPA_PROP_live 2026-03-27 18:03:24 +01:00
avb security: fix missing NULL check and integer overflow in AVB ringbuffer 2026-04-28 13:05:09 +02:00
bluez5 security: add missing NULL checks after calloc in Bluetooth backend 2026-04-29 14:22:53 +02:00
control mixer: handle control.ump property 2026-03-25 11:59:43 +01:00
ffmpeg spa: use log topics everywhere 2024-03-11 18:45:21 +02:00
filter-graph security: add missing NULL checks after calloc/strdup in filter-graph 2026-04-29 14:20:46 +02:00
jack *: don't include standard C headers inside of extern "C" 2025-05-30 09:48:28 +01:00
libcamera spa: libcamera: use std::span 2026-03-27 09:57:56 +01:00
support security: add missing O_CLOEXEC/SOCK_CLOEXEC flags 2026-04-28 12:20:33 +02:00
test spa: do not use SPA_PROP_live 2026-03-27 18:03:24 +01:00
v4l2 security: add missing O_CLOEXEC flag to V4L2 device open 2026-04-28 12:56:40 +02:00
videoconvert overflow: fix some more potential overflows 2026-04-27 12:29:31 +02:00
videotestsrc spa: do not use SPA_PROP_live 2026-03-27 18:03:24 +01:00
volume treewide: access the position information using helpers 2025-10-21 13:06:25 +02:00
vulkan vulkan: fix wrong descriptor image info index 2026-04-21 15:13:03 +00:00
meson.build spa/plugins: revert "Disable alsa plugin on !Linux platforms." 2026-03-12 09:20:05 +00:00