Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp709828imu; Fri, 11 Jan 2019 07:46:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN4oNTLNAaW56nS7CqMLHYbnqI01VJPtHH9aD+N75tHB25c9vv7ajzfUKd5sO7z9tagRFNCY X-Received: by 2002:a63:2905:: with SMTP id p5mr8805220pgp.178.1547221571226; Fri, 11 Jan 2019 07:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547221571; cv=none; d=google.com; s=arc-20160816; b=jG8LhChVXPM171XZBgd7HslWzlvOO4fMXXyeRG3g5bLDUl2jz/MUZuu+A8UYoZqnP/ 1npFn46e85BwdFRy+TlvEactcXxoXdBDUCGahEgvnqvV53V+AE1tzf3GLgDyRWXCsaC9 n6NmaXnG3a3xptUxSbz7eNwfkidUQgK4IlB53jj9A1ZoPuBGP92m+B0lHBiQXetnw1Ai RQBDBXbrOfbcoHAjKqrJV3IjLPAi+rMPd/Vml+zWgt9qt7YS8G5Yczsq+/vC2kkIsfEB 9v3wP/TK39jWQZrdCEjBv0iJ+mE7w5NDHV2YCQ6o2ownAKmVGKQ3bHoXPYbSy7a2ti2/ oJ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=A53VjIo0UNWpBu4cu3greeBouSKeH5i75tHLOCLgNs8=; b=ZBabmw9VmFfHKTFuvDgrSfM4xd/1AaOyTmP4nv6s/cKdUTBO2brTmJQs3bt8Vw3xCS O9qZQ5LUTgx2lXQbtuIcikZgIRLLCHUswBO+cKiQMKuj88RkgbIKYvG9TEN5aV0CxXIz rrrq+KUkbjK2G0WI14mSp4jF789F4WOKA8LTw9oL+vVgFD/EsVesQN6d4SIeaEpcjEHP +syFedjWuoitzeyoEWV4pMh0fn1+gd6Wju9QnKRyDqGc96JSeffyIIbxMW6n7NwLhGdz WF5O/fsD0zxW+mO/ikcF3BKWOaQhYQXhaZJf2ot/jeajC+KoWks710cLDTL68RZVZkw1 3YKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si4797000pgb.245.2019.01.11.07.45.52; Fri, 11 Jan 2019 07:46:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732064AbfAKPoH (ORCPT + 99 others); Fri, 11 Jan 2019 10:44:07 -0500 Received: from mga02.intel.com ([134.134.136.20]:19251 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731856AbfAKPoG (ORCPT ); Fri, 11 Jan 2019 10:44:06 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 07:44:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,466,1539673200"; d="scan'208";a="290802073" Received: from dnorris1-mobl1.amr.corp.intel.com (HELO [10.254.187.45]) ([10.254.187.45]) by orsmga005.jf.intel.com with ESMTP; 11 Jan 2019 07:44:04 -0800 Subject: Re: [alsa-devel] [PATCH] ASoC: soc-core: Fix null pointer dereference in soc_find_component To: Rohit kumar , 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 References: <1547194442-1487-1-git-send-email-rohitkr@codeaurora.org> From: Pierre-Louis Bossart Message-ID: Date: Fri, 11 Jan 2019 09:44:04 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1547194442-1487-1-git-send-email-rohitkr@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/11/19 2:14 AM, Rohit kumar wrote: > From: Ajit Pandey > > 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 > > Fixes: 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list") > Reported-by: Pierre-Louis Bossart > Signed-off-by: Ajit Pandey > Signed-off-by: Rohit kumar > --- > 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