[PATCH] [UBUNTU:sound/pci/{cs46xx, hda}/] Fix race in removing device

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Fri Jun 2 21:22:32 UTC 2006


Subject: [PATCH] [UBUNTU:sound/pci/{cs46xx,hda}/] Fix race in removing device

UpstreamStatus: Added in upstream alsa-kernel hg changesets
                89652d0c1446 and 609ed891f23e;
                http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=89652d0c144633754e168cc075b5a515ce22d0d6;style=raw ,
                http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=609ed891f23e1b27945b15c643c3b72e427fbfd4;style=raw

Takashi Iwai committed the above fixes to avoid invalid accesses in
shared irq after a device is removed.

cf. https://bugzilla.novell.com/show_bug.cgi?id=167869 [requires login]

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>

---

 sound/pci/cs46xx/cs46xx_lib.c |    5 +++--
 sound/pci/hda/hda_intel.c     |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

0a5208e0ccc60341e9eabedf671320c0c1df64f4
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 9b8af5b..b89450f 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -2902,14 +2902,15 @@ static int snd_cs46xx_free(cs46xx_t *chi
 	if (chip->region.idx[0].resource)
 		snd_cs46xx_hw_stop(chip);
 
+	if (chip->irq >= 0)
+		free_irq(chip->irq, (void *)chip);
+
 	for (idx = 0; idx < 5; idx++) {
 		snd_cs46xx_region_t *region = &chip->region.idx[idx];
 		if (region->remap_addr)
 			iounmap(region->remap_addr);
 		release_and_free_resource(region->resource);
 	}
-	if (chip->irq >= 0)
-		free_irq(chip->irq, (void *)chip);
 
 	if (chip->active_ctrl)
 		chip->active_ctrl(chip, -chip->amplifier);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ec5708e..829d561 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1395,10 +1395,10 @@ static int azx_free(azx_t *chip)
 		msleep(1);
 	}
 
-	if (chip->remap_addr)
-		iounmap(chip->remap_addr);
 	if (chip->irq >= 0)
 		free_irq(chip->irq, (void*)chip);
+	if (chip->remap_addr)
+		iounmap(chip->remap_addr);
 
 	if (chip->bdl.area)
 		snd_dma_free_pages(&chip->bdl);
-- 
1.1.3


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060602/2ac48f65/attachment.pgp>


More information about the kernel-team mailing list