This is a note to let you know that I've just added the patch titled

    ALSA: aloop - Fix possible IRQ lock inversion

to the 2.6.38-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-aloop-fix-possible-irq-lock-inversion.patch
and it can be found in the queue-2.6.38 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 98d21df431ad55281e1abf780f8d51e3391900b2 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Fri, 18 Mar 2011 07:31:53 +0100
Subject: ALSA: aloop - Fix possible IRQ lock inversion

From: Takashi Iwai <[email protected]>

commit 98d21df431ad55281e1abf780f8d51e3391900b2 upstream.

loopback_pos_update() can be called in the timer callback, thus the lock
held should be irq-safe.  Otherwise you'll get AB/BA deadlock together
with substream->self_group.lock.

Reported-and-tested-by: Knut Petersen <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 sound/drivers/aloop.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -482,8 +482,9 @@ static unsigned int loopback_pos_update(
                        cable->streams[SNDRV_PCM_STREAM_CAPTURE];
        unsigned long delta_play = 0, delta_capt = 0;
        unsigned int running;
+       unsigned long flags;
 
-       spin_lock(&cable->lock);        
+       spin_lock_irqsave(&cable->lock, flags);
        running = cable->running ^ cable->pause;
        if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) {
                delta_play = jiffies - dpcm_play->last_jiffies;
@@ -495,10 +496,8 @@ static unsigned int loopback_pos_update(
                dpcm_capt->last_jiffies += delta_capt;
        }
 
-       if (delta_play == 0 && delta_capt == 0) {
-               spin_unlock(&cable->lock);
-               return running;
-       }
+       if (delta_play == 0 && delta_capt == 0)
+               goto unlock;
                
        if (delta_play > delta_capt) {
                loopback_bytepos_update(dpcm_play, delta_play - delta_capt,
@@ -510,14 +509,14 @@ static unsigned int loopback_pos_update(
                delta_capt = delta_play;
        }
 
-       if (delta_play == 0 && delta_capt == 0) {
-               spin_unlock(&cable->lock);
-               return running;
-       }
+       if (delta_play == 0 && delta_capt == 0)
+               goto unlock;
+
        /* note delta_capt == delta_play at this moment */
        loopback_bytepos_update(dpcm_capt, delta_capt, BYTEPOS_UPDATE_COPY);
        loopback_bytepos_update(dpcm_play, delta_play, BYTEPOS_UPDATE_POSONLY);
-       spin_unlock(&cable->lock);
+ unlock:
+       spin_unlock_irqrestore(&cable->lock, flags);
        return running;
 }
 


Patches currently in stable-queue which might be from [email protected] are

queue-2.6.38/alsa-ctxfi-clear-input-settings-before-initialization.patch
queue-2.6.38/alsa-ctxfi-fix-spdif-status-retrieval.patch
queue-2.6.38/alsa-hda-fix-volume-control-naming-for-surround-speakers-on-realtek-auto-parser.patch
queue-2.6.38/alsa-hda-enable-surround-and-subwoofer-on-lenovo-ideapad-y530.patch
queue-2.6.38/alsa-sound-pci-asihpi-check-adapter-index-in-hpi_ioctl.patch
queue-2.6.38/alsa-ctxfi-fix-incorrect-spdif-status-bit-mask.patch
queue-2.6.38/alsa-hda-fix-digital-mic-selection-in-mixer-on-92hd8x-codecs.patch
queue-2.6.38/alsa-hda-realtek-alc88x-do-not-over-initialize-speakers-and-hp-that-are-primary-outputs.patch
queue-2.6.38/alsa-aloop-fix-possible-irq-lock-inversion.patch
queue-2.6.38/alsa-hda-fixup-unnecessary-volume-control-index-on-realtek-alc88x.patch
queue-2.6.38/xhci-fix-cycle-bit-calculation-during-stall-handling.patch
queue-2.6.38/alsa-hda-initialize-special-cases-for-input-src-in-init-phase.patch
queue-2.6.38/xhci-update-internal-dequeue-pointers-after-stalls.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to