Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp408371pxb; Thu, 21 Jan 2021 09:52:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYHa/6Dubo+wFjwSwHMGf2QDemGjR/u9ish29XR2ZMq2HdWYOePHbdNpbCkOP7ndK9kWFW X-Received: by 2002:a17:906:3b82:: with SMTP id u2mr461828ejf.66.1611251541152; Thu, 21 Jan 2021 09:52:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611251541; cv=none; d=google.com; s=arc-20160816; b=OIxmtmCJid6mAIhpaBOzmgfnF5d+B1v7/fPOTZas5hV63IpjmjVcnFOoQSNAQZt7LB smaEXjikyHpjqiWPdbgKQZupYwWVXIXuwZasmep/SSKHirsZVUPEyL52CSyxdYGcBt4g hdfw1Ti+M3GZKA4pijh+6v0elDaULcPYdbnUfubQ89l/vtUQsvDl50uPw/DOWhMxCmUw 16grQF6Tf4g4WLGgjCtG03vBOYPs4DmcRgNCGCmpoxoAArwId3QZxKxhgbnNsvBA8fQL x2QaQuOpIHf4rIZKoYNnQP5x2/+qfN9VDz78iOd95hMKOs8q8vAxsMjkLMqk48RvHW7Y HNJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=pvkfhZaPp0jSJSOd9sLk3XLWMQjPLIr7cqe292MPYRU=; b=PXcVhAH02GgR3Y/kH2PZhaqLJyzJh7oCYZaZCLRIlMr292s+LlE8EwXwek+9l/AGmB UuMYy7QLCvGSNazH3NleQoDWlCRd3SwaNP6RsYZmbC6CRgP0C1ygfaJ9+AmmTgKiD2M5 Hc6Fp7Kc7c957/ZGXufIXeJSUJ2iJfqH+ajb97AxFsPiucYQHZOGXF7XCFQQj4WEz2jL 3HvECU8gLHJ73G6qqhwqbmvvE5cmHftbVjxSYU2hhEqsfA6grKmZfYIpLx8+oQYGXKSN hnlz1Y/DdW+ZnkRhRy1uvaj+YyZKUpLXPrOY1F3XgnyDKLOEv2XPRYf7OWukr7DmQ1+B QKuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id n5si2547076eda.301.2021.01.21.09.51.55; Thu, 21 Jan 2021 09:52:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2389120AbhAURsE (ORCPT + 99 others); Thu, 21 Jan 2021 12:48:04 -0500 Received: from mga07.intel.com ([134.134.136.100]:30940 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389104AbhAURrQ (ORCPT ); Thu, 21 Jan 2021 12:47:16 -0500 IronPort-SDR: ROO8cuwcpUha8mo+hwjLipvN32FSQD90VdNH57mCELSdodjEWCeXU25Q+j8q1wah1ro2Iigd+B CjHYiKxblr7A== X-IronPort-AV: E=McAfee;i="6000,8403,9871"; a="243384025" X-IronPort-AV: E=Sophos;i="5.79,364,1602572400"; d="scan'208";a="243384025" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 09:45:24 -0800 IronPort-SDR: FGDfNZ5uVSfF+AG8jkgOhNj4k+ISYc+3flz+AUhyvW2Xz7k42lbQWl8DPt88RyTfFGD7vJvvL8 eSjdS52jpIiQ== X-IronPort-AV: E=Sophos;i="5.79,364,1602572400"; d="scan'208";a="351532590" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2021 09:45:21 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l2e2J-007oKb-28; Thu, 21 Jan 2021 19:46:23 +0200 Date: Thu, 21 Jan 2021 19:46:23 +0200 From: Andy Shevchenko To: Ricardo Ribalda Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , Jaroslav Kysela , Takashi Iwai , Mateusz Gorski , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lukasz Majczak Subject: Re: [PATCH v2 1/2] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Message-ID: References: <20210121171644.131059-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210121171644.131059-1-ribalda@chromium.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 21, 2021 at 06:16:43PM +0100, Ricardo Ribalda wrote: > If dobj->control is not initialized we end up in an OOPs during > skl_tplg_complete: > > [ 26.553358] BUG: kernel NULL pointer dereference, address: > 0000000000000078 > [ 26.561151] #PF: supervisor read access in kernel mode > [ 26.566897] #PF: error_code(0x0000) - not-present page > [ 26.572642] PGD 0 P4D 0 > [ 26.575479] Oops: 0000 [#1] PREEMPT SMP PTI > [ 26.580158] CPU: 2 PID: 2082 Comm: udevd Tainted: G C > 5.4.81 #4 > [ 26.588232] Hardware name: HP Soraka/Soraka, BIOS > Google_Soraka.10431.106.0 12/03/2019 > [ 26.597082] RIP: 0010:skl_tplg_complete+0x70/0x144 [snd_soc_skl] Reviewed-by: Andy Shevchenko > Fixes: 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL") > Signed-off-by: Ricardo Ribalda > --- > sound/soc/intel/skylake/skl-topology.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c > index ae466cd59292..1ef30ca45410 100644 > --- a/sound/soc/intel/skylake/skl-topology.c > +++ b/sound/soc/intel/skylake/skl-topology.c > @@ -3619,15 +3619,16 @@ static void skl_tplg_complete(struct snd_soc_component *component) > > list_for_each_entry(dobj, &component->dobj_list, list) { > struct snd_kcontrol *kcontrol = dobj->control.kcontrol; > - struct soc_enum *se = > - (struct soc_enum *)kcontrol->private_value; > - char **texts = dobj->control.dtexts; > + struct soc_enum *se; > + char **texts; A nit-pick: Can we place this after below line? > char chan_text[4]; > > - if (dobj->type != SND_SOC_DOBJ_ENUM || > - dobj->control.kcontrol->put != > - skl_tplg_multi_config_set_dmic) > + if (dobj->type != SND_SOC_DOBJ_ENUM || !kcontrol || > + kcontrol->put != skl_tplg_multi_config_set_dmic) > continue; > + > + se = (struct soc_enum *)kcontrol->private_value; > + texts = dobj->control.dtexts; > sprintf(chan_text, "c%d", mach->mach_params.dmic_num); > > for (i = 0; i < se->items; i++) { > -- > 2.30.0.296.g2bfb1c46d8-goog > -- With Best Regards, Andy Shevchenko