+ fix-ab-ba-deadlock-inversion-at-cs46xx_dsp_remove_scb.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     fix AB-BA deadlock inversion at cs46xx_dsp_remove_scb

has been added to the -mm tree.  Its filename is

     fix-ab-ba-deadlock-inversion-at-cs46xx_dsp_remove_scb.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: fix AB-BA deadlock inversion at cs46xx_dsp_remove_scb
From: Arjan van de Ven <arjan@xxxxxxxxxxxxx>

There is a code sequence where the locking is substream->self_group.lock ->
ins->scbs[index].lock

substream->self_group.lock is interrupt safe, and taken from irq context
as well (trace is snipped for brevity)

so what can happen is

cpu 0                   	cpu 1
user context			user context

				take ins->scbs[index].lock without disabling interrupts

get substream->self_group.lock (irqsafe)
try to get ins->scbs[index].lock (spins)

				interrupt happens
				try to get substream->self_group.lock (spins)


which is an obvious AB-BA deadlock

fix is to just take the lock with _irqsafe

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Cc: Jaroslav Kysela <perex@xxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 sound/pci/cs46xx/dsp_spos_scb_lib.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN sound/pci/cs46xx/dsp_spos_scb_lib.c~fix-ab-ba-deadlock-inversion-at-cs46xx_dsp_remove_scb sound/pci/cs46xx/dsp_spos_scb_lib.c
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c~fix-ab-ba-deadlock-inversion-at-cs46xx_dsp_remove_scb
+++ a/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -180,6 +180,7 @@ static void _dsp_clear_sample_buffer (st
 void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * scb)
 {
 	struct dsp_spos_instance * ins = chip->dsp_spos_instance;
+	unsignded long flags;
 
 	/* check integrety */
 	snd_assert ( (scb->index >= 0 && 
@@ -194,9 +195,9 @@ void cs46xx_dsp_remove_scb (struct snd_c
 		     goto _end);
 #endif
 
-	spin_lock(&scb->lock);
+	spin_lock_irqsave(&scb->lock, flags);
 	_dsp_unlink_scb (chip,scb);
-	spin_unlock(&scb->lock);
+	spin_unlock_irqrestore(&scb->lock, flags);
 
 	cs46xx_dsp_proc_free_scb_desc(scb);
 	snd_assert (scb->scb_symbol != NULL, return );
_

Patches currently in -mm which might be from arjan@xxxxxxxxxxxxx are

origin.patch
fix-ab-ba-deadlock-inversion-at-cs46xx_dsp_remove_scb.patch
debug-shared-irqs.patch
vdso-print-fatal-signals.patch
vdso-improve-print_fatal_signals-support-by-adding-memory-maps.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux