linux/sound/core/seq
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
Kconfig ALSA: seq: Make dependency on UMP clearer 2025-01-01 13:56:48 +01:00
Makefile ALSA: core: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:32 +02:00
seq_clientmgr.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
seq_clientmgr.h ALSA: seq: Use RCU for the client port list 2026-08-10 17:44:34 +02:00
seq_compat.c ALSA: seq: Serialize compat port-info ioctls 2026-09-17 14:34:32 +02:00
seq_dummy.c Merge branch 'for-linus' into for-next 2026-06-07 09:27:04 +02:00
seq_fifo.c ALSA: seq: avoid stale FIFO cells during resize 2026-06-14 10:57:10 +02:00
seq_fifo.h ALSA: seq: Clean up fifo locking with guard 2025-08-29 11:52:36 +02:00
seq_info.c
seq_info.h
seq_lock.c
seq_lock.h
seq_memory.c ALSA: seq: Fix uninitialised heap leak in snd_seq_event_dup() 2026-06-24 11:03:25 +02:00
seq_memory.h ALSA: seq: Add UMP support 2023-05-23 12:11:21 +02:00
seq_midi_emul.c ALSA: seq: Use flexible array for MIDI channels 2026-05-15 08:52:44 +02:00
seq_midi_event.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
seq_midi.c ALSA: seq: midi: Serialize input teardown with event_input 2026-08-13 18:21:51 +02:00
seq_ports.c ALSA: seq: Use RCU for the client port list 2026-08-10 17:44:34 +02:00
seq_ports.h ALSA: seq: Use RCU for the port subscriber list 2026-08-10 17:44:34 +02:00
seq_prioq.c ALSA: seq: Remove arbitrary prioq insertion limit 2026-05-26 07:54:36 +02:00
seq_prioq.h
seq_queue.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
seq_queue.h ALSA: seq: Clean up queue locking with auto cleanup 2025-08-29 11:52:35 +02:00
seq_system.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
seq_system.h ALSA: seq: Notify UMP EP and FB changes 2025-01-12 13:12:21 +01:00
seq_timer.c ALSA: seq: Fix division by zero in initialize_timer() 2026-07-25 08:53:34 +02:00
seq_timer.h ALSA: seq: Remove unused declarations 2024-08-17 16:32:31 +02:00
seq_ump_client.c ALSA: seq: Use RCU for the UMP client output substream 2026-08-10 17:44:34 +02:00
seq_ump_convert.c ALSA: core/seq: Optimize the return logic in cc_ev_to_ump_midi2 2026-03-27 14:40:24 +01:00
seq_ump_convert.h ALSA: seq: Fix delivery of UMP events to group ports 2025-05-11 15:58:06 +02:00
seq_virmidi.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
seq.c