From: Rohit kumar <rohitkr@codeaurora.org>
To: plai@codeaurora.org, bgoswami@codeaurora.org,
asishb@codeaurora.org, lgirdwood@gmail.com, broonie@kernel.org,
perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, rohkumar@qti.qualcomm.com,
srinivas.kandagatla@linaro.org, vinod.koul@linaro.org
Cc: Ajit Pandey <ajitp@codeaurora.org>, Rohit kumar <rohitkr@codeaurora.org>
Subject: [PATCH] ASoC: soc-core: Fix null pointer dereference in soc_find_component
Date: Fri, 11 Jan 2019 13:44:02 +0530 [thread overview]
Message-ID: <1547194442-1487-1-git-send-email-rohitkr@codeaurora.org> (raw)
From: Ajit Pandey <ajitp@codeaurora.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.
Fixes: 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
Signed-off-by: Rohit kumar <rohitkr@codeaurora.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
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
next reply other threads:[~2019-01-11 8:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 8:14 Rohit kumar [this message]
2019-01-11 15:44 ` [alsa-devel] [PATCH] ASoC: soc-core: Fix null pointer dereference in soc_find_component Pierre-Louis Bossart
2019-01-11 21:49 ` Pierre-Louis Bossart
2019-01-12 6:07 ` Rohit kumar
2019-01-14 15:40 ` Liam Girdwood
2019-01-15 0:06 ` Mark Brown
2019-01-15 3:08 ` Pierre-Louis Bossart
2019-01-15 19:35 ` Pierre-Louis Bossart
2019-01-15 21:07 ` Mark Brown
2019-01-15 21:11 ` Matthias Reichl
2019-01-15 21:16 ` Pierre-Louis Bossart
2019-01-15 21:41 ` Mark Brown
2019-01-15 21:48 ` Matthias Reichl
2019-01-18 23:02 ` Pierre-Louis Bossart
[not found] ` <CAOReqxjhZAzOpr-bGcV6uxPsOEid--Ym2Y0YZMHkybgZSePvtQ@mail.gmail.com>
2019-01-19 1:15 ` Curtis Malainey
2019-01-21 18:30 ` Mark Brown
2019-01-22 20:11 ` Pierre-Louis Bossart
2019-01-23 1:36 ` Curtis Malainey
2019-01-23 2:01 ` Pierre-Louis Bossart
2019-01-24 18:44 ` Mark Brown
2019-01-24 19:07 ` Pierre-Louis Bossart
2019-01-24 19:26 ` Mark Brown
2019-01-25 1:32 ` Curtis Malainey
2019-01-21 19:17 ` Mark Brown
2019-01-14 23:26 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1547194442-1487-1-git-send-email-rohitkr@codeaurora.org \
--to=rohitkr@codeaurora.org \
--cc=ajitp@codeaurora.org \
--cc=alsa-devel@alsa-project.org \
--cc=asishb@codeaurora.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=rohkumar@qti.qualcomm.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
--cc=vinod.koul@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).