[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8726e9a-3477-a573-8c1a-dd8245068802@linux.intel.com>
Date: Fri, 11 Jan 2019 09:44:04 -0600
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Rohit kumar <rohitkr@...eaurora.org>, plai@...eaurora.org,
bgoswami@...eaurora.org, asishb@...eaurora.org,
lgirdwood@...il.com, broonie@...nel.org, perex@...ex.cz,
tiwai@...e.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, rohkumar@....qualcomm.com,
srinivas.kandagatla@...aro.org, vinod.koul@...aro.org
Cc: Ajit Pandey <ajitp@...eaurora.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: soc-core: Fix null pointer dereference
in soc_find_component
On 1/11/19 2:14 AM, Rohit kumar wrote:
> From: Ajit Pandey <ajitp@...eaurora.org>
>
> soc_find_component() may lead to null pointer exception if both
> arguments i.e of_node and name is NULL. Add NULL check before
> calling soc_find_component(). Also fix some typos.
Thanks for the overnight fix. This update fixes the issue on my Skylake
XPS13 test device (blind testing since I don't understand what the code
does).
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
>
> Fixes: 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list")
> Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
> Signed-off-by: Ajit Pandey <ajitp@...eaurora.org>
> Signed-off-by: Rohit kumar <rohitkr@...eaurora.org>
> ---
> sound/soc/soc-core.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 0934b36..df05fb8 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1131,11 +1131,13 @@ static int soc_init_dai_link(struct snd_soc_card *card,
> }
>
> /*
> - * Defer card registartion if platform dai component is not added to
> + * Defer card registration if platform dai component is not added to
> * component list.
> */
> - if (!soc_find_component(link->platform->of_node, link->platform->name))
> - return -EPROBE_DEFER;
> + if (link->platform->of_node || link->platform->name)
> + if (!soc_find_component(link->platform->of_node,
> + link->platform->name))
> + return -EPROBE_DEFER;
>
> /*
> * CPU device may be specified by either name or OF node, but
> @@ -1150,11 +1152,12 @@ static int soc_init_dai_link(struct snd_soc_card *card,
> }
>
> /*
> - * Defer card registartion if cpu dai component is not added to
> + * Defer card registration if cpu dai component is not added to
> * component list.
> */
> - if (!soc_find_component(link->cpu_of_node, link->cpu_name))
> - return -EPROBE_DEFER;
> + if (link->cpu_of_node || link->cpu_name)
> + if (!soc_find_component(link->cpu_of_node, link->cpu_name))
> + return -EPROBE_DEFER;
>
> /*
> * At least one of CPU DAI name or CPU device name/node must be
Powered by blists - more mailing lists