diff mbox series

[SRU,Eoan,1/1] ASoC: topology: fix soc_tplg_fe_link_create() - link->dobj initialization order

Message ID 20200222092054.8484-2-hui.wang@canonical.com
State New
Headers show
Series Fix the crash of sof driver in the -41 kernel | expand

Commit Message

Hui Wang Feb. 22, 2020, 9:20 a.m. UTC
From: Jaroslav Kysela <perex@perex.cz>

BugLink: https://bugs.launchpad.net/bugs/1864061

The code which checks the return value for snd_soc_add_dai_link() call
in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before
link->dobj members initialization.

While it does not affect the latest kernels, the old soc-core.c code
in the stable kernels is affected. The snd_soc_add_dai_link() function uses
the link->dobj.type member to check, if the link structure is valid.

Reorder the link->dobj initialization to make things work again.
It's harmless for the recent code (and the structure should be properly
initialized before other calls anyway).

The problem is in stable linux-5.4.y since version 5.4.11 when the
upstream commit 76d270364932 was applied.

Fixes: 76d270364932 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
Cc: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200122190752.3081016-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 8ce1cbd6ce0b1bda0c980c64fee4c1e1378355f1)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/soc-topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Po-Hsu Lin Feb. 24, 2020, 1:23 p.m. UTC | #1
Clean cherry-pick, positive test results.
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Kleber Sacilotto de Souza Feb. 25, 2020, 3:36 p.m. UTC | #2
On 22.02.20 10:20, Hui Wang wrote:
> From: Jaroslav Kysela <perex@perex.cz>
> 
> BugLink: https://bugs.launchpad.net/bugs/1864061
> 
> The code which checks the return value for snd_soc_add_dai_link() call
> in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before
> link->dobj members initialization.
> 
> While it does not affect the latest kernels, the old soc-core.c code
> in the stable kernels is affected. The snd_soc_add_dai_link() function uses
> the link->dobj.type member to check, if the link structure is valid.
> 
> Reorder the link->dobj initialization to make things work again.
> It's harmless for the recent code (and the structure should be properly
> initialized before other calls anyway).
> 
> The problem is in stable linux-5.4.y since version 5.4.11 when the
> upstream commit 76d270364932 was applied.
> 
> Fixes: 76d270364932 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
> Cc: Dragos Tarcatu <dragos_tarcatu@mentor.com>
> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
> Link: https://lore.kernel.org/r/20200122190752.3081016-1-perex@perex.cz
> Signed-off-by: Mark Brown <broonie@kernel.org>
> (cherry picked from commit 8ce1cbd6ce0b1bda0c980c64fee4c1e1378355f1)
> Signed-off-by: Hui Wang <hui.wang@canonical.com>

Clean cherry-pick and good test results.

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>


Another patch has been sent on another thread with the same BugLink:

[SRU][Eoan][PATCH] UBUNTU: [Config] disable SND_SOC_INTEL_SKYLAKE

While it's relatively easy to understand their relation to fix issues with
the same driver after reading the bug report, it would be easier for
us to review and process these patches if they were sent on the same
thread and with some explanation for the reason why both of them are needed.
So next time please group all the patches for a given bug report together,
or at least all patches for a bug/series combination.

Kleber

> ---
>  sound/soc/soc-topology.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index 1c281848ee20..3fa191d74d62 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -1897,6 +1897,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
>  	link->num_codecs = 1;
>  	link->num_platforms = 1;
>  
> +	link->dobj.index = tplg->index;
> +	link->dobj.ops = tplg->ops;
> +	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
> +
>  	if (strlen(pcm->pcm_name)) {
>  		link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
>  		link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
> @@ -1933,9 +1937,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
>  		goto err;
>  	}
>  
> -	link->dobj.index = tplg->index;
> -	link->dobj.ops = tplg->ops;
> -	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
>  	list_add(&link->dobj.list, &tplg->comp->dobj_list);
>  
>  	return 0;
>
Hui Wang Feb. 26, 2020, 12:11 a.m. UTC | #3
On 2020/2/25 下午11:36, Kleber Souza wrote:
> On 22.02.20 10:20, Hui Wang wrote:
>> From: Jaroslav Kysela <perex@perex.cz>
>>
>> BugLink: https://bugs.launchpad.net/bugs/1864061
>>
>> The code which checks the return value for snd_soc_add_dai_link() call
>> in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before
>> link->dobj members initialization.
>>
>> While it does not affect the latest kernels, the old soc-core.c code
>> in the stable kernels is affected. The snd_soc_add_dai_link() function uses
>> the link->dobj.type member to check, if the link structure is valid.
>>
>> Reorder the link->dobj initialization to make things work again.
>> It's harmless for the recent code (and the structure should be properly
>> initialized before other calls anyway).
>>
>> The problem is in stable linux-5.4.y since version 5.4.11 when the
>> upstream commit 76d270364932 was applied.
>>
>> Fixes: 76d270364932 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
>> Cc: Dragos Tarcatu <dragos_tarcatu@mentor.com>
>> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
>> Cc: Mark Brown <broonie@kernel.org>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
>> Link: https://lore.kernel.org/r/20200122190752.3081016-1-perex@perex.cz
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> (cherry picked from commit 8ce1cbd6ce0b1bda0c980c64fee4c1e1378355f1)
>> Signed-off-by: Hui Wang <hui.wang@canonical.com>
> Clean cherry-pick and good test results.
>
> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
>
>
> Another patch has been sent on another thread with the same BugLink:
>
> [SRU][Eoan][PATCH] UBUNTU: [Config] disable SND_SOC_INTEL_SKYLAKE
>
> While it's relatively easy to understand their relation to fix issues with
> the same driver after reading the bug report, it would be easier for
> us to review and process these patches if they were sent on the same
> thread and with some explanation for the reason why both of them are needed.
> So next time please group all the patches for a given bug report together,
> or at least all patches for a bug/series combination.
>
> Kleber

OK, got it. I thought only the 1st patch was needed to fix this bug, but 
someone reported a new issue after I sent out the 1st patch, so I sent 
out one more patch for this bug.

Thanks,

Hui.

>> ---
>>   sound/soc/soc-topology.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
>> index 1c281848ee20..3fa191d74d62 100644
>> --- a/sound/soc/soc-topology.c
>> +++ b/sound/soc/soc-topology.c
>> @@ -1897,6 +1897,10 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
>>   	link->num_codecs = 1;
>>   	link->num_platforms = 1;
>>   
>> +	link->dobj.index = tplg->index;
>> +	link->dobj.ops = tplg->ops;
>> +	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
>> +
>>   	if (strlen(pcm->pcm_name)) {
>>   		link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
>>   		link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
>> @@ -1933,9 +1937,6 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
>>   		goto err;
>>   	}
>>   
>> -	link->dobj.index = tplg->index;
>> -	link->dobj.ops = tplg->ops;
>> -	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
>>   	list_add(&link->dobj.list, &tplg->comp->dobj_list);
>>   
>>   	return 0;
>>
diff mbox series

Patch

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 1c281848ee20..3fa191d74d62 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1897,6 +1897,10 @@  static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 	link->num_codecs = 1;
 	link->num_platforms = 1;
 
+	link->dobj.index = tplg->index;
+	link->dobj.ops = tplg->ops;
+	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
+
 	if (strlen(pcm->pcm_name)) {
 		link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
 		link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
@@ -1933,9 +1937,6 @@  static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 		goto err;
 	}
 
-	link->dobj.index = tplg->index;
-	link->dobj.ops = tplg->ops;
-	link->dobj.type = SND_SOC_DOBJ_DAI_LINK;
 	list_add(&link->dobj.list, &tplg->comp->dobj_list);
 
 	return 0;