aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-11-21 03:08:06 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-21 03:08:06 -0500
commitb94d3539de59ec6481e38f83c455324fd3aeabc1 (patch)
treecc6034e70d130f02d0e87bcedb9fc4ccf71b66ce /sound/pci/hda/patch_sigmatel.c
parent0623536ca3e8fd7cb8b7468b0fd4d61d80f0b6ea (diff)
ALSA: hda - Fix double free of jack instances
The jack instances created in patch_sigmatel.c may be double-freed. The device management code checks the invalid element, and thus there is no real breakage, but it spews annoying warning messages. But, we can't simply remove the release calls of these jack instances because they have to be freed when the codec is re-configured. Now, a new flag, bus->shutdown is introduced to indicate that the bus is really being unloaded, i.e. the objects managed by the device manager will be automatically deleted. We release these objects only when this flag isn't set. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a501c9121649..4fa5189264b7 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3921,8 +3921,9 @@ static int stac92xx_init(struct hda_codec *codec)
3921static void stac92xx_free_jacks(struct hda_codec *codec) 3921static void stac92xx_free_jacks(struct hda_codec *codec)
3922{ 3922{
3923#ifdef CONFIG_SND_JACK 3923#ifdef CONFIG_SND_JACK
3924 /* free jack instances manually when clearing/reconfiguring */
3924 struct sigmatel_spec *spec = codec->spec; 3925 struct sigmatel_spec *spec = codec->spec;
3925 if (spec->jacks.list) { 3926 if (!codec->bus->shutdown && spec->jacks.list) {
3926 struct sigmatel_jack *jacks = spec->jacks.list; 3927 struct sigmatel_jack *jacks = spec->jacks.list;
3927 int i; 3928 int i;
3928 for (i = 0; i < spec->jacks.used; i++) 3929 for (i = 0; i < spec->jacks.used; i++)