linux/sound/core/seq
Takashi Iwai a26b9a4b32 ALSA: seq: Fix races at MIDI encoding in snd_virmidi_output_trigger()
commit 8f22e52528 upstream.

The sequencer virmidi code has an open race at its output trigger
callback: namely, virmidi keeps only one event packet for processing
while it doesn't protect for concurrent output trigger calls.

snd_virmidi_output_trigger() tries to process the previously
unfinished event before starting encoding the given MIDI stream, but
this is done without any lock.  Meanwhile, if another rawmidi stream
starts the output trigger, this proceeds further, and overwrites the
event package that is being processed in another thread.  This
eventually corrupts and may lead to the invalid memory access if the
event type is like SYSEX.

The fix is just to move the spinlock to cover both the pending event
and the new stream.

The bug was spotted by a new fuzzer, RaceFuzzer.

BugLink: http://lkml.kernel.org/r/20180426045223.GA15307@dragonet.kaist.ac.kr
Reported-by: DaeRyong Jeong <threeearcat@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-10-21 08:45:47 +01:00
..
oss ALSA: seq: oss: Hardening for potential Spectre v1 2018-10-21 08:45:42 +01:00
Kconfig ALSA: clean up the logic for building sequencer modules 2009-05-29 11:49:42 +02:00
Makefile ALSA: OSS sequencer should be initialized after snd_seq_system_client_init 2009-07-19 19:10:01 +02:00
seq.c device.h: cleanup users outside of linux/include (C files) 2012-03-11 14:27:37 -04:00
seq_clientmgr.c ALSA: seq: Clear client entry before deleting else at closing 2018-06-16 22:22:37 +01:00
seq_clientmgr.h ALSA: seq: Make ioctls race-free 2018-02-13 18:42:31 +00:00
seq_compat.c ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode 2016-02-02 19:09:59 +00:00
seq_device.c ALSA: seq: Use standard printk helpers 2014-02-14 08:14:18 +01:00
seq_dummy.c ALSA: seq-dummy: remove deadlock-causing events on close 2015-02-04 10:58:17 +00:00
seq_fifo.c ALSA: seq: More protection for concurrent write and ioctl races 2018-06-16 22:21:32 +01:00
seq_fifo.h [ALSA] Remove xxx_t typedefs: Sequencer 2006-01-03 12:17:52 +01:00
seq_info.c sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where needed 2011-10-31 19:31:22 -04:00
seq_info.h [ALSA] Optimize for config without PROC_FS (seq and oss parts) 2006-01-03 12:30:05 +01:00
seq_lock.c ALSA: seq: Enable 'use' locking in all configurations 2017-11-11 13:33:40 +00:00
seq_lock.h ALSA: seq: Enable 'use' locking in all configurations 2017-11-11 13:33:40 +00:00
seq_memory.c ALSA: seq: More protection for concurrent write and ioctl races 2018-06-16 22:21:32 +01:00
seq_memory.h ALSA: seq: More protection for concurrent write and ioctl races 2018-06-16 22:21:32 +01:00
seq_midi.c ALSA: core: Fix format string mismatch in seq_midi.c 2014-04-28 12:18:47 +02:00
seq_midi_emul.c ALSA: seq: Use standard printk helpers 2014-02-14 08:14:18 +01:00
seq_midi_event.c sound: Add module.h to the previously silent sound users 2011-10-31 19:31:21 -04:00
seq_ports.c ALSA: seq: Fix use-after-free at creating a port 2017-11-11 13:33:38 +00:00
seq_ports.h [ALSA] Remove xxx_t typedefs: Sequencer 2006-01-03 12:17:52 +01:00
seq_prioq.c ALSA: seq: Fix possible UAF in snd_seq_check_queue() 2018-06-16 22:22:36 +01:00
seq_prioq.h ALSA: seq: Fix possible UAF in snd_seq_check_queue() 2018-06-16 22:22:36 +01:00
seq_queue.c ALSA: seq: Fix possible UAF in snd_seq_check_queue() 2018-06-16 22:22:36 +01:00
seq_queue.h [ALSA] semaphore -> mutex (core part) 2006-03-22 10:24:50 +01:00
seq_system.c sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where needed 2011-10-31 19:31:22 -04:00
seq_system.h [ALSA] Remove xxx_t typedefs: Sequencer 2006-01-03 12:17:52 +01:00
seq_timer.c ALSA: seq: Remove spurious WARN_ON() at timer check 2018-03-03 15:51:40 +00:00
seq_timer.h [ALSA] sound/core/seq: move declarations of globally visible variables to proper headers 2008-01-31 17:29:35 +01:00
seq_virmidi.c ALSA: seq: Fix races at MIDI encoding in snd_virmidi_output_trigger() 2018-10-21 08:45:47 +01:00