linux/sound
Alexey Khoroshilov 30b0fd903d sound/oss: fix deadlock in sequencer_ioctl(SNDCTL_SEQ_OUTOFBAND)
commit bc26d4d06e upstream.

A deadlock can be initiated by userspace via ioctl(SNDCTL_SEQ_OUTOFBAND)
on /dev/sequencer with TMR_ECHO midi event.

In this case the control flow is:
sound_ioctl()
-> case SND_DEV_SEQ:
   case SND_DEV_SEQ2:
     sequencer_ioctl()
     -> case SNDCTL_SEQ_OUTOFBAND:
          spin_lock_irqsave(&lock,flags);
          play_event();
          -> case EV_TIMING:
               seq_timing_event()
               -> case TMR_ECHO:
                    seq_copy_to_input()
                    -> spin_lock_irqsave(&lock,flags);

It seems that spin_lock_irqsave() around play_event() is not necessary,
because the only other call location in seq_startplay() makes the call
without acquiring spinlock.

So, the patch just removes spinlocks around play_event().
By the way, it removes unreachable code in seq_timing_event(),
since (seq_mode == SEQ_2) case is handled in the beginning.

Compile tested only.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-17 09:53:51 -07:00
..
aoa sound fixes for 3.13-rc1 2013-11-16 12:50:53 -08:00
arm ALSA: AACI: Convert to modern PM ops 2013-12-03 17:43:42 +01:00
atmel Merge branch 'for-linus' into for-next 2013-12-16 15:53:52 +01:00
core ALSA: control: Add sanity checks for user ctl id name string 2015-03-26 15:06:55 +01:00
drivers ALSA: pcsp: Fix the order of input device unregistration 2013-11-14 15:50:10 +01:00
firewire ALSA: dice: fix array limits in dice_proc_read() 2013-11-29 10:23:04 +01:00
i2c ALSA: ak411x: Fix stall in work callback 2015-02-11 14:54:49 +08:00
isa ALSA: isa: not allocating enough space 2013-11-13 09:28:31 +01:00
mips ALSA: mips/ad1843: Use WARN_ON() instead of BUG_ON() 2013-11-06 08:35:16 +01:00
oss sound/oss: fix deadlock in sequencer_ioctl(SNDCTL_SEQ_OUTOFBAND) 2015-05-17 09:53:51 -07:00
parisc ALSA: Remove the rest of *_set_drvdata(NULL) calls 2013-05-29 12:50:59 +02:00
pci ALSA: hda - Add mute-LED mode control to Thinkpad 2015-05-13 05:16:56 -07:00
pcmcia sound/pcmcia: use module_pcmcia_driver() in pcmcia drivers 2013-03-15 12:26:39 -07:00
ppc Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-11-18 15:50:07 -08:00
sh ALSA: sh_dac_audio: Remove redundant platform_set_drvdata() 2013-05-23 14:36:45 +02:00
soc ASoC: davinci-evm: drop un-necessary remove function 2015-05-06 21:59:18 +02:00
sparc ALSA: sparc: fix missing unlock on error in snd_cs4231_playback_prepare() 2013-11-11 16:23:16 +01:00
spi ALSA: at73c213: clk_round_rate() can return a zero upon error 2013-12-10 21:19:47 +01:00
synth ALSA: emux: Fix mutex deadlock in OSS emulation 2015-05-13 05:16:56 -07:00
usb ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support 2015-04-19 10:11:05 +02:00
Kconfig sound: remove reference to feature-removal-schedule.txt 2012-12-17 17:15:12 -08:00
Makefile
ac97_bus.c
last.c ALSA: Remove the last mention of SNDRV_MAIN_OBJECT_FILE 2012-09-03 10:07:23 +02:00
sound_core.c consolidate the reassignments of ->f_op in ->open() instances 2013-10-24 23:34:53 -04:00
sound_firmware.c sound_firmware: don't bother with filp_close() 2013-04-09 15:16:32 -04:00