diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2014-10-03 08:32:40 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-03 10:39:19 -0400 |
commit | b2d9de549c30170eed5691d369cf16680e0ce03a (patch) | |
tree | 7de459e18dda0ac4f4a032222d246bd245f0f939 | |
parent | 0bd2ac3dae74ee25c5ea171cb572731c7a89c248 (diff) |
ASoC: dapm: Fix NULL pointer dereference when registering card with widgets
Commit 0bd2ac3dae74 ("ASoC: Remove CODEC pointer from snd_soc_dapm_context")
introduced regression to snd_soc_dapm_new_controls() when registering a card
with card->dapm_widgets set. Call chain is:
snd_soc_register_card()
-> snd_soc_instantiate_card()
-> snd_soc_dapm_new_controls()
-> snd_soc_dapm_new_control()
Null pointer dereference occurs since card->dapm context doesn't have
associated component. Fix this by setting widget codec pointer
conditionally.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/soc-dapm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1f1e9657481a..231deb220506 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3107,7 +3107,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3107 | } | 3107 | } |
3108 | 3108 | ||
3109 | w->dapm = dapm; | 3109 | w->dapm = dapm; |
3110 | w->codec = dapm->component->codec; | 3110 | if (dapm->component) |
3111 | w->codec = dapm->component->codec; | ||
3111 | INIT_LIST_HEAD(&w->sources); | 3112 | INIT_LIST_HEAD(&w->sources); |
3112 | INIT_LIST_HEAD(&w->sinks); | 3113 | INIT_LIST_HEAD(&w->sinks); |
3113 | INIT_LIST_HEAD(&w->list); | 3114 | INIT_LIST_HEAD(&w->list); |