aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ca0106
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-04-22 11:28:11 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:41 -0400
commitebf029da38829ede6b53ac8a5ad45b149064ea16 (patch)
treeaebf6bddd245a874577fc321978b3f7137e8ac39 /sound/pci/ca0106
parent6b9a9b329640b7e8143df7b2782884ea758650f7 (diff)
[ALSA] Fix possible races at free_irq in PCI drivers
The irq handler of PCI drivers must be released before releasing other resources since the handler for a shared irq can be still called and may access the freed resource again. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ca0106')
-rw-r--r--sound/pci/ca0106/ca0106_main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 3818249fcc81..ecbe79b67e43 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1114,6 +1114,8 @@ static int snd_ca0106_free(struct snd_ca0106 *chip)
1114 * So we can fix: snd-malloc: Memory leak? pages not freed = 8 1114 * So we can fix: snd-malloc: Memory leak? pages not freed = 8
1115 */ 1115 */
1116 } 1116 }
1117 if (chip->irq >= 0)
1118 free_irq(chip->irq, chip);
1117 // release the data 1119 // release the data
1118#if 1 1120#if 1
1119 if (chip->buffer.area) 1121 if (chip->buffer.area)
@@ -1123,9 +1125,6 @@ static int snd_ca0106_free(struct snd_ca0106 *chip)
1123 // release the i/o port 1125 // release the i/o port
1124 release_and_free_resource(chip->res_port); 1126 release_and_free_resource(chip->res_port);
1125 1127
1126 // release the irq
1127 if (chip->irq >= 0)
1128 free_irq(chip->irq, chip);
1129 pci_disable_device(chip->pci); 1128 pci_disable_device(chip->pci);
1130 kfree(chip); 1129 kfree(chip);
1131 return 0; 1130 return 0;