Skip to contentSkip to conversation

fm801: Fix double free in case of error in tuner detection

PATCH Applied Ben Hutchings 2 participants 2 messages Sep 22, 2011 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fm801: Fix double free in case of error in tuner detection

Commit 9676001559fce06e37c7dc230ab275f605556176 ("ALSA: fm801: add error handling if auto-detect fails") added incorrect error handling.

Once we have successfully called snd_device_new(), the cleanup function fm801_free() will automatically be called by snd_card_free() and we must *not* also call fm801_free() directly.

References: http://bugs.debian.org/641946

---
 sound/pci/fm801.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
sound/pci/fm801.c +0 -2
index a7ec703..0dd8963 100644
@@ -1236,7 +1236,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
 	    (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
 		if (snd_tea575x_init(&chip->tea)) {
 			snd_printk(KERN_ERR "TEA575x radio not found\n");
-			snd_fm801_free(chip);
 			return -ENODEV;
 		}
 	} else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) {
@@ -1251,7 +1250,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
 		}
 		if (tea575x_tuner == 4) {
 			snd_printk(KERN_ERR "TEA575x radio not found\n");
-			snd_fm801_free(chip);
 			return -ENODEV;
 		}
 	}
Signature · 1 line
1.7.5.4
Applied
#1 lore raw

At Thu, 22 Sep 2011 14:38:58 +0100,

Quoted 5 lines · Ben Hutchings

Commit 9676001559fce06e37c7dc230ab275f605556176 ("ALSA: fm801: add error handling if auto-detect fails") added incorrect error handling.

Quoted 8 lines

Once we have successfully called snd_device_new(), the cleanup function fm801_free() will automatically be called by snd_card_free() and we must *not* also call fm801_free() directly.

References: http://bugs.debian.org/641946

Thanks, applied both patches now.

Takashi

Quoted 29 lines
---
 sound/pci/fm801.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
sound/pci/fm801.c +0 -2
index a7ec703..0dd8963 100644
@@ -1236,7 +1236,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
 	    (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
 		if (snd_tea575x_init(&chip->tea)) {
 			snd_printk(KERN_ERR "TEA575x radio not found\n");
-			snd_fm801_free(chip);
 			return -ENODEV;
 		}
 	} else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) {
@@ -1251,7 +1250,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
 		}
 		if (tea575x_tuner == 4) {
 			snd_printk(KERN_ERR "TEA575x radio not found\n");
-			snd_fm801_free(chip);
 			return -ENODEV;
 		}
 	}
Signature · 1 line
1.7.5.4