linux/sound/core
Kyle Zeng 95b2e0361c ALSA: seq: Serialize compat port-info ioctls
The native sequencer ioctl path serializes handler calls with
client->ioctl_mutex, but the translated port-info compat path invokes the
same handlers through snd_seq_kernel_client_ctl() without taking that
mutex.

This lets concurrent compat CREATE_PORT requests pass the port-count
check before any request reaches the serialized insertion. The computed
integer port index can then exceed the address field range and wrap to an
existing index. Subsequent subscriber teardown can resolve the duplicate
address to the wrong port and access a freed subscriber.

Take ioctl_mutex while dispatching converted port-info requests, matching
the native ioctl path. All translated port-info commands share this
helper, so their accesses to the client port state are serialized as
well.

Fixes: b3defb791b ("ALSA: seq: Make ioctls race-free")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6-sol gpt-6-astra
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Bruno Produit <bruno.produit@trailofbits.com>
Link: https://patch.msgid.link/20260917105643.90102-1-bruno.produit@trailofbits.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-09-17 14:34:32 +02:00
..
oss treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
seq ALSA: seq: Serialize compat port-info ioctls 2026-09-17 14:34:32 +02:00
.kunitconfig ALSA: core: add kunitconfig 2024-03-17 09:36:45 +01:00
compress_offload.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
control_compat.c ALSA: control: Drop __force casts 2026-08-13 16:43:27 +02:00
control_led.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
control_trace.h ALSA: control: Verify put() result when in debug mode 2026-02-28 09:32:39 +01:00
control.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
ctljack.c ALSA: jack: Improve string handling in jack_kctl_name_gen 2026-01-27 09:58:37 +01:00
device.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
hrtimer.c ALSA: core: Mark some variables as __ro_after_init 2026-05-25 09:31:40 +02:00
hwdep_compat.c
hwdep.c ALSA: core: Clean up file_operations definitions 2026-07-13 12:01:27 +02:00
info_oss.c ALSA: info: Use guard() for locking 2024-02-28 15:01:21 +01:00
info.c ALSA: info: Return -ENODEV instead of -EFAULT in alloc_info_private() 2026-07-08 12:44:52 +02:00
init.c ASoC: Fixes for v7.3 2026-09-17 08:15:32 +02:00
isadma.c sound updates for 6.0-rc1 2022-08-06 10:19:51 -07:00
jack.c ALSA: core: Clean up file_operations definitions 2026-07-13 12:01:27 +02:00
Kconfig ALSA: Do not build obsolete API 2025-12-07 13:15:59 +01:00
Makefile ALSA: control: Verify put() result when in debug mode 2026-02-28 09:32:39 +01:00
memalloc.c mm: introduce vma_get_page_prot() and use it 2026-08-06 18:57:03 -07:00
memory.c ALSA: Align the syntax of iov_iter helpers with standard ones 2024-12-30 12:50:04 +01:00
misc.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
pcm_compat.c ALSA: pcm: Fix unlocked runtime state reads in xfer ioctls 2026-06-06 18:18:04 +02:00
pcm_dmaengine.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pcm_drm_eld.c ALSA: pcm_drm_eld: rate-limit ELD parsing errors 2026-05-16 16:20:07 +02:00
pcm_iec958.c
pcm_lib.c ALSA: pcm: fix __le32 cast warning in snd_pcm_set_sync_per_card 2026-06-18 12:33:59 +02:00
pcm_local.h ALSA: pcm: Revert "ALSA: pcm: rewrite snd_pcm_playback_silence()" 2023-05-05 18:23:48 +02:00
pcm_memory.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
pcm_misc.c ALSA: pcm: Drop __force casts 2026-08-13 16:43:27 +02:00
pcm_native.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
pcm_param_trace.h
pcm_timer.c ALSA: pcm: set timer->private_data before registering the PCM timer 2026-09-13 18:38:03 +02:00
pcm_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
pcm.c ALSA: pcm: Drop __force casts 2026-08-13 16:43:27 +02:00
rawmidi_compat.c ALSA: rawmidi: Replace with __packed attribute 2023-10-26 09:42:55 +02:00
rawmidi.c ALSA: rawmidi: Return the error from snd_rawmidi_input_params() 2026-09-02 15:30:14 +02:00
seq_device.c ALSA: seq: Use flexible array for device arguments 2026-06-01 11:28:32 +02:00
sound_kunit.c ALSA: kunit: Drop __force casts 2026-08-13 16:43:27 +02:00
sound_oss.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sound.c ALSA: core: Clean up file_operations definitions 2026-07-13 12:01:27 +02:00
timer_compat.c ALSA: timer: Manage timer object with kref 2026-06-10 09:36:28 +02:00
timer.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
ump_convert.c ALSA: ump: Fix corrupted data bytes at MIDI 1.0 SysEx to UMP conversion 2026-08-08 09:01:34 +02:00
ump.c ALSA: ump: do not touch legacy_rmidi before it exists 2026-09-02 11:10:49 +02:00
vmaster.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00