summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhalchandra Gajare <gajare@codeaurora.org>2015-10-26 16:25:44 -0700
committerKyle Yan <kyan@codeaurora.org>2016-07-06 15:41:25 -0700
commit9464621a103d77cf8d2f4cfa2e04ea6370539cf3 (patch)
treea2d2feed8496167cee0bad3fdd2cd1113313327d
parentb72eb30dea984a515ede30d69c3b04f4cde5f6a4 (diff)
ASoC: core: Fix possible NULL pointer de-reference
Fix the soc_find_component function to make sure either the of_node or the name is provided to compare against the registered components to fix possible NULL pointer de-reference. CRs-fixed: 925138 Change-Id: Ic1f02c341c06cadcfe6de638ff6c86e51845e59f Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
-rw-r--r--sound/soc/soc-core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c9e54acb06ec..cac2d4975a15 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -876,6 +876,12 @@ struct snd_soc_component *soc_find_component(
{
struct snd_soc_component *component;
+ if (!of_node && !name) {
+ pr_err("%s: Either of_node or name must be valid\n",
+ __func__);
+ return NULL;
+ }
+
lockdep_assert_held(&client_mutex);
list_for_each_entry(component, &component_list, list) {