alistair23-linux/sound
Jesper Juhl c83f1d7e71 ASoC: wm2000: Fix use-after-free - don't release_firmware() twice on error
In wm2000_i2c_probe(), if we take the true branch in

"
  ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000,
                               NULL, 0);
  if (ret != 0)
          goto err_fw;
"

then we'll release_firmware(fw) at the 'err_fw' label. But we've already
done that just a few lines above. That's a use-after-free bug.

This patch restructures the code so that we always call
release_firmware(fw) before leaving the function, but only ever call
it once.
This means that we have to initialize 'fw' to NULL since some paths
may now end up calling it without having called request_firmware(),
but since request_firmware() deals gracefully with NULL pointers, we
are fine if we just NULL initialize it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-24 11:34:19 +00:00
..
aoa Merge branch 'master' into for-next 2011-11-13 20:55:53 +01:00
arm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound 2012-01-12 08:00:30 -08:00
atmel Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2012-01-17 18:40:24 -08:00
core Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound 2012-01-17 10:48:13 -08:00
drivers ALSA: module_param: make bool parameters really bool 2011-12-19 10:34:41 +01:00
firewire
i2c
isa ALSA: module_param: make bool parameters really bool 2011-12-19 10:34:41 +01:00
mips ALSA: Convert mips directory to module_platform_driver 2011-11-24 13:03:02 +01:00
oss Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound 2012-01-12 08:00:30 -08:00
parisc
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound 2012-01-17 10:48:13 -08:00
pcmcia ALSA: module_param: make bool parameters really bool 2011-12-19 10:34:41 +01:00
ppc Merge branch 'topic/misc' into for-linus 2012-01-12 09:59:14 +01:00
sh ALSA: module_param: make bool parameters really bool 2011-12-19 10:34:41 +01:00
soc ASoC: wm2000: Fix use-after-free - don't release_firmware() twice on error 2012-01-24 11:34:19 +00:00
sparc ALSA: module_param: make bool parameters really bool 2011-12-19 10:34:41 +01:00
spi
synth
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound 2012-01-12 08:00:30 -08:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c switch device_get_devnode() and ->devnode() to umode_t * 2012-01-03 22:54:55 -05:00
sound_firmware.c