* [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets
@ 2014-10-03 12:32 Jarkko Nikula
2014-10-03 13:26 ` Lars-Peter Clausen
2014-10-03 14:39 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Jarkko Nikula @ 2014-10-03 12:32 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood, Lars-Peter Clausen
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>
---
sound/soc/soc-dapm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2d06892088d5..3f0b4108f7ca 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3125,7 +3125,8 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
}
w->dapm = dapm;
- w->codec = dapm->component->codec;
+ if (dapm->component)
+ w->codec = dapm->component->codec;
INIT_LIST_HEAD(&w->sources);
INIT_LIST_HEAD(&w->sinks);
INIT_LIST_HEAD(&w->list);
--
2.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets
2014-10-03 12:32 [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets Jarkko Nikula
@ 2014-10-03 13:26 ` Lars-Peter Clausen
2014-10-03 14:39 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-10-03 13:26 UTC (permalink / raw)
To: Jarkko Nikula, alsa-devel; +Cc: Mark Brown, Liam Girdwood
On 10/03/2014 02:32 PM, Jarkko Nikula wrote:
> 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>
Thanks. Stupid mistake.
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets
2014-10-03 12:32 [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets Jarkko Nikula
2014-10-03 13:26 ` Lars-Peter Clausen
@ 2014-10-03 14:39 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-10-03 14:39 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: alsa-devel, Lars-Peter Clausen, Liam Girdwood
[-- Attachment #1.1: Type: text/plain, Size: 285 bytes --]
On Fri, Oct 03, 2014 at 03:32:40PM +0300, Jarkko Nikula wrote:
> 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:
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-03 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03 12:32 [PATCH] ASoC: dapm: Fix NULL pointer dereference when registering card with widgets Jarkko Nikula
2014-10-03 13:26 ` Lars-Peter Clausen
2014-10-03 14:39 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.