linux/sound
Jarkko Nikula 2697e4fb92 ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol
Commit 9e1fda4ae158 ("ASoC: dapm: Implement mixer input auto-disable")
is trying to free the widget it allocated by snd_soc_dapm_new_control()
call in dapm_kcontrol_data_alloc() by adding kfree(data->widget) to
dapm_kcontrol_free().

This is causing a widget double free with auto-disabled DAPM kcontrols
in sound card unregistration because widgets are already freed before
dapm_kcontrol_free() is called.

Reason for that is all widgets are added into dapm->card->widgets list
in snd_soc_dapm_new_control() and freed in dapm_free_widgets() during
execution of snd_soc_dapm_free().

Now snd_soc_dapm_free() calls for different DAPM contexts happens before
snd_card_free() call from where the call chain to dapm_kcontrol_free()
begins:

soc_cleanup_card_resources()
  soc_remove_dai_links()
    soc_remove_link_dais()
      snd_soc_dapm_free(&cpu_dai->dapm)
    soc_remove_link_components()
      soc_remove_platform()
        snd_soc_dapm_free(&platform->dapm)
      soc_remove_codec()
        snd_soc_dapm_free(&codec->dapm)
  snd_soc_dapm_free(&card->dapm)
  snd_card_free()
    snd_card_do_free()
      snd_device_free_all()
        snd_device_free()
          snd_ctl_dev_free()
            snd_ctl_remove()
              snd_ctl_free_one()
                dapm_kcontrol_free()

This wasn't making harm with ordinary DAPM kcontrols since data->widget is NULL for
them.

Fixes: 9e1fda4ae158 (ASoC: dapm: Implement mixer input auto-disable)
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-04-21 11:49:53 +01:00
..
aoa ALSA: Drop __bitwise and typedefs for snd_device attributes 2014-02-14 08:20:24 +01:00
arm ALSA: arm: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:03 +01:00
atmel ALSA: atmel: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:04 +01:00
core Merge branch 'for-next' into for-linus 2014-03-31 12:16:31 +02:00
drivers ALSA: drivers: Convert to snd_card_new() with a device pointer 2014-02-12 10:58:20 +01:00
firewire ALSA: firewire: Convert to snd_card_new() with a device pointer 2014-02-14 08:13:31 +01:00
i2c ALSA: cs8427: separate HW initialization 2014-04-03 14:59:48 +02:00
isa Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-04-07 16:36:11 -07:00
mips ALSA: au1x00: use module_platform_driver() 2014-04-09 10:02:14 +02:00
oss sound fixes for 3.15-rc1 2014-04-10 09:19:44 -07:00
parisc ALSA: parisc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:05 +01:00
pci sound fixes for 3.15-rc1 2014-04-10 09:19:44 -07:00
pcmcia ALSA: pcmcia: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:06 +01:00
ppc ALSA: ppc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:06 +01:00
sh ALSA: sh: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:07 +01:00
soc ASoC: dapm: Fix widget double free with auto-disable DAPM kcontrol 2014-04-21 11:49:53 +01:00
sparc ALSA: sparc: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:07 +01:00
spi ALSA: spi: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:08 +01:00
synth
usb ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() 2014-04-09 21:07:38 +02:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c consolidate the reassignments of ->f_op in ->open() instances 2013-10-24 23:34:53 -04:00
sound_firmware.c