]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: soc-dapm: fix use after free
authorDaniel Mack <daniel@zonque.org>
Tue, 7 Oct 2014 11:41:24 +0000 (13:41 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 7 Oct 2014 12:11:35 +0000 (13:11 +0100)
commit342562f86210bdfc99533ed69a8e70dc1b4dfc24
tree67be9d9351f59ab72e9f93242908190ad9c79ae4
parent092211c7d7b91199e77d8c9488bf4d1bf2095823
ASoC: soc-dapm: fix use after free

Coverity spotted the following possible use-after-free condition in
dapm_create_or_share_mixmux_kcontrol():

If kcontrol is NULL, and (wname_in_long_name && kcname_in_long_name)
validates to true, 'name' will be set to an allocated string, and be
freed a few lines later via the 'long_name' alias. 'name', however,
is used by dev_err() in case snd_ctl_add() fails.

Fix this by adding a jump label that frees 'long_name' at the end of
the function.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
sound/soc/soc-dapm.c