linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete
@ 2020-12-11 17:06 Ricardo Ribalda
  2020-12-11 17:13 ` Mark Brown
  2020-12-14 17:07 ` Gorski, Mateusz
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2020-12-11 17:06 UTC (permalink / raw)
  To: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Mateusz Gorski,
	Andy Shevchenko, alsa-devel, linux-kernel
  Cc: Ricardo Ribalda

If dobj->control is not initialized we end up in an OOPs during
skl_tplg_complete:

[   26.553358] BUG: kernel NULL pointer dereference, address:
0000000000000078
[   26.561151] #PF: supervisor read access in kernel mode
[   26.566897] #PF: error_code(0x0000) - not-present page
[   26.572642] PGD 0 P4D 0
[   26.575479] Oops: 0000 [#1] PREEMPT SMP PTI
[   26.580158] CPU: 2 PID: 2082 Comm: udevd Tainted: G         C
5.4.81 #4
[   26.588232] Hardware name: HP Soraka/Soraka, BIOS
Google_Soraka.10431.106.0 12/03/2019
[   26.597082] RIP: 0010:skl_tplg_complete+0x70/0x144 [snd_soc_skl]

Fixes: 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 sound/soc/intel/skylake/skl-topology.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 40bee10b0c65..0955cbb4e918 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -3619,19 +3619,20 @@ static void skl_tplg_complete(struct snd_soc_component *component)
 
 	list_for_each_entry(dobj, &component->dobj_list, list) {
 		struct snd_kcontrol *kcontrol = dobj->control.kcontrol;
-		struct soc_enum *se =
-			(struct soc_enum *)kcontrol->private_value;
-		char **texts = dobj->control.dtexts;
+		struct soc_enum *se;
+		char **texts;
 		char chan_text[4];
 
-		if (dobj->type != SND_SOC_DOBJ_ENUM ||
-		    dobj->control.kcontrol->put !=
-		    skl_tplg_multi_config_set_dmic)
+		if (dobj->type != SND_SOC_DOBJ_ENUM || !kcontrol ||
+		    kcontrol->put != skl_tplg_multi_config_set_dmic)
 			continue;
+
+		se = (struct soc_enum *)kcontrol->private_value;
+		texts = dobj->control.dtexts;
 		sprintf(chan_text, "c%d", mach->mach_params.dmic_num);
 
 		for (i = 0; i < se->items; i++) {
-			struct snd_ctl_elem_value val;
+			struct snd_ctl_elem_value val = {};
 
 			if (strstr(texts[i], chan_text)) {
 				val.value.enumerated.item[0] = i;
-- 
2.29.2.576.ga3fc446d84-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete
  2020-12-11 17:06 [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Ricardo Ribalda
@ 2020-12-11 17:13 ` Mark Brown
  2020-12-14 17:07 ` Gorski, Mateusz
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-12-11 17:13 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Jaroslav Kysela, Takashi Iwai, Mateusz Gorski, Andy Shevchenko,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

On Fri, Dec 11, 2020 at 06:06:29PM +0100, Ricardo Ribalda wrote:

> If dobj->control is not initialized we end up in an OOPs during
> skl_tplg_complete:

>  		for (i = 0; i < se->items; i++) {
> -			struct snd_ctl_elem_value val;
> +			struct snd_ctl_elem_value val = {};

This bit looks like a separate fix?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete
  2020-12-11 17:06 [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Ricardo Ribalda
  2020-12-11 17:13 ` Mark Brown
@ 2020-12-14 17:07 ` Gorski, Mateusz
  2020-12-15 17:07   ` Ricardo Ribalda
  1 sibling, 1 reply; 4+ messages in thread
From: Gorski, Mateusz @ 2020-12-14 17:07 UTC (permalink / raw)
  To: Ricardo Ribalda, Cezary Rojewski, Pierre-Louis Bossart,
	Liam Girdwood, Jie Yang, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Andy Shevchenko, alsa-devel, linux-kernel


> If dobj->control is not initialized we end up in an OOPs during
> skl_tplg_complete:
>
> [   26.553358] BUG: kernel NULL pointer dereference, address:
> 0000000000000078
> [   26.561151] #PF: supervisor read access in kernel mode
> [   26.566897] #PF: error_code(0x0000) - not-present page
> [   26.572642] PGD 0 P4D 0
> [   26.575479] Oops: 0000 [#1] PREEMPT SMP PTI
> [   26.580158] CPU: 2 PID: 2082 Comm: udevd Tainted: G         C
> 5.4.81 #4
> [   26.588232] Hardware name: HP Soraka/Soraka, BIOS
> Google_Soraka.10431.106.0 12/03/2019
> [   26.597082] RIP: 0010:skl_tplg_complete+0x70/0x144 [snd_soc_skl]
>
> Fixes: 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>   sound/soc/intel/skylake/skl-topology.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> index 40bee10b0c65..0955cbb4e918 100644
> --- a/sound/soc/intel/skylake/skl-topology.c
> +++ b/sound/soc/intel/skylake/skl-topology.c
> @@ -3619,19 +3619,20 @@ static void skl_tplg_complete(struct snd_soc_component *component)
>   
>   	list_for_each_entry(dobj, &component->dobj_list, list) {
>   		struct snd_kcontrol *kcontrol = dobj->control.kcontrol;
> -		struct soc_enum *se =
> -			(struct soc_enum *)kcontrol->private_value;
> -		char **texts = dobj->control.dtexts;
> +		struct soc_enum *se;
> +		char **texts;
>   		char chan_text[4];
>   
> -		if (dobj->type != SND_SOC_DOBJ_ENUM ||
> -		    dobj->control.kcontrol->put !=
> -		    skl_tplg_multi_config_set_dmic)
> +		if (dobj->type != SND_SOC_DOBJ_ENUM || !kcontrol ||
> +		    kcontrol->put != skl_tplg_multi_config_set_dmic)
>   			continue;
> +
> +		se = (struct soc_enum *)kcontrol->private_value;
> +		texts = dobj->control.dtexts;
>   		sprintf(chan_text, "c%d", mach->mach_params.dmic_num);
>   
>   		for (i = 0; i < se->items; i++) {
> -			struct snd_ctl_elem_value val;
> +			struct snd_ctl_elem_value val = {};
>   
>   			if (strstr(texts[i], chan_text)) {
>   				val.value.enumerated.item[0] = i;


Hi Ricardo,

there is another thread regarding this issue (with fix provided by 
Lukasz Majczak), you can find it here:

     https://www.spinics.net/lists/stable/msg431524.html


Thanks,
Mateusz


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete
  2020-12-14 17:07 ` Gorski, Mateusz
@ 2020-12-15 17:07   ` Ricardo Ribalda
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2020-12-15 17:07 UTC (permalink / raw)
  To: Gorski, Mateusz
  Cc: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Andy Shevchenko,
	alsa-devel, Linux Kernel Mailing List

Hi Mateusz

On Mon, Dec 14, 2020 at 6:07 PM Gorski, Mateusz
<mateusz.gorski@linux.intel.com> wrote:
>
>
> > If dobj->control is not initialized we end up in an OOPs during
> > skl_tplg_complete:
> >
> > [   26.553358] BUG: kernel NULL pointer dereference, address:
> > 0000000000000078
> > [   26.561151] #PF: supervisor read access in kernel mode
> > [   26.566897] #PF: error_code(0x0000) - not-present page
> > [   26.572642] PGD 0 P4D 0
> > [   26.575479] Oops: 0000 [#1] PREEMPT SMP PTI
> > [   26.580158] CPU: 2 PID: 2082 Comm: udevd Tainted: G         C
> > 5.4.81 #4
> > [   26.588232] Hardware name: HP Soraka/Soraka, BIOS
> > Google_Soraka.10431.106.0 12/03/2019
> > [   26.597082] RIP: 0010:skl_tplg_complete+0x70/0x144 [snd_soc_skl]
> >
> > Fixes: 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL")
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > ---
> >   sound/soc/intel/skylake/skl-topology.c | 15 ++++++++-------
> >   1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> > index 40bee10b0c65..0955cbb4e918 100644
> > --- a/sound/soc/intel/skylake/skl-topology.c
> > +++ b/sound/soc/intel/skylake/skl-topology.c
> > @@ -3619,19 +3619,20 @@ static void skl_tplg_complete(struct snd_soc_component *component)
> >
> >       list_for_each_entry(dobj, &component->dobj_list, list) {
> >               struct snd_kcontrol *kcontrol = dobj->control.kcontrol;
> > -             struct soc_enum *se =
> > -                     (struct soc_enum *)kcontrol->private_value;
> > -             char **texts = dobj->control.dtexts;
> > +             struct soc_enum *se;
> > +             char **texts;
> >               char chan_text[4];
> >
> > -             if (dobj->type != SND_SOC_DOBJ_ENUM ||
> > -                 dobj->control.kcontrol->put !=
> > -                 skl_tplg_multi_config_set_dmic)
> > +             if (dobj->type != SND_SOC_DOBJ_ENUM || !kcontrol ||
> > +                 kcontrol->put != skl_tplg_multi_config_set_dmic)
> >                       continue;
> > +
> > +             se = (struct soc_enum *)kcontrol->private_value;
> > +             texts = dobj->control.dtexts;
> >               sprintf(chan_text, "c%d", mach->mach_params.dmic_num);
> >
> >               for (i = 0; i < se->items; i++) {
> > -                     struct snd_ctl_elem_value val;
> > +                     struct snd_ctl_elem_value val = {};
> >
> >                       if (strstr(texts[i], chan_text)) {
> >                               val.value.enumerated.item[0] = i;
>
>
> Hi Ricardo,
>
> there is another thread regarding this issue (with fix provided by
> Lukasz Majczak), you can find it here:
>
>      https://www.spinics.net/lists/stable/msg431524.html

I saw it just after I sent it :(. The most embarrassing thing is that
we are working in the same project ;)

Sorry for the noise

>
>
> Thanks,
> Mateusz
>


-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 17:06 [PATCH] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Ricardo Ribalda
2020-12-11 17:13 ` Mark Brown
2020-12-14 17:07 ` Gorski, Mateusz
2020-12-15 17:07   ` Ricardo Ribalda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).