Alexey Khoroshilov bc26d4d06e sound/oss: fix deadlock in sequencer_ioctl(SNDCTL_SEQ_OUTOFBAND)
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>
2015-04-18 09:05:55 +02:00
..
2009-07-29 14:37:12 +02:00
2012-10-06 16:47:53 +02:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2012-03-28 18:30:03 +01:00
2006-10-03 23:01:26 +02:00
2005-04-16 15:20:36 -07:00
2011-03-31 11:26:23 -03:00
2005-04-16 15:20:36 -07:00
2015-02-25 20:08:21 +01:00
2005-04-16 15:20:36 -07:00
2012-10-06 16:47:53 +02:00
2006-10-03 23:01:26 +02:00
2005-04-16 15:20:36 -07:00
2014-01-14 16:12:07 +01:00
2006-10-04 07:55:32 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2012-10-06 16:47:53 +02:00
2005-04-16 15:20:36 -07:00
2012-03-28 18:30:03 +01:00

The modular sound driver patches were funded by Red Hat Software 
(www.redhat.com). The sound driver here is thus a modified version of 
Hannu's code. Please bear that in mind when considering the appropriate
forums for bug reporting. 

Alan Cox