Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp385155pxb; Thu, 21 Jan 2021 09:18:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmwwZSAg1AgeE9I1cnb+rtqdcpOuDHQDf3wDCwzMdwxJPPvTa8eulqE+2vFqudJOMCIbjo X-Received: by 2002:aa7:c3c4:: with SMTP id l4mr111597edr.255.1611249533991; Thu, 21 Jan 2021 09:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611249533; cv=none; d=google.com; s=arc-20160816; b=mBIWlVcA8OtGQc555zkRx0fmTzskuCITv0w7j1CxlTh5UYgiOE2WLNv3fSiPpIolqC 3Qf5uX6g8LXtwc81Cu00Z9jdrmQgDtVDQ7xXCtvl6/6L933aODif4+Hff1AGaWPooHBj GfH+oKxkbYu64dsxIVQU8EsvhlZeGXoxh4aPCb1Eq2TaI4IgxHBelwhtRTS2mS1odLdf 5oA2xjaQnifqM1SgkUWhPxzkrGGb1JG567WEgajDGQZOMhxrrDXC+YoIjmetiR4bKJR5 JXPrxh9ifLkb9Hb8MmmwB/4tGK/4KXCIa5q1OwDx6yDZ9JY58GNp6yqmfXzDwh7gJcJZ z6GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0/+GpgvuePk5y5rT7DgZg88TKWg6HgWIEtHm/4SPvYk=; b=KN/4M8phYtaTTrgne5IWUf5kad2thds62ivkLYRHdtBNZPOSQcRsJHacCqsnpSzNZ9 38eIejtfsy6N1wfD7vkWmV2Tuc9uRrjTOA4/d1p6/2ZH8vltlWS2xJjyLWH/MWGj9uTK H1VlOauvhCC351bNtIzLa9/2UVPF7lLvs7nkstaN0PcOs65M4Cp3aX3bKLIwe790ceFo jZ5sxjPQpgpx+aLfqT6STTG1e6DZKbPD2jjCb8ag0ax70bn683Mx9keaPizgVSm1nekH 4YKYI68eR2Uvwi6IvwfrdByC6Mw7w0C3h2rhY+d9Wo3+T1MPyb5pnUb01aw7IMH90lja 9YYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TlAdl9ky; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yr3si2038495ejb.153.2021.01.21.09.18.20; Thu, 21 Jan 2021 09:18:53 -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; dkim=pass header.i=@chromium.org header.s=google header.b=TlAdl9ky; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388623AbhAURRh (ORCPT + 99 others); Thu, 21 Jan 2021 12:17:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388718AbhAURRa (ORCPT ); Thu, 21 Jan 2021 12:17:30 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482EAC06174A for ; Thu, 21 Jan 2021 09:16:48 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id h16so3390100edt.7 for ; Thu, 21 Jan 2021 09:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0/+GpgvuePk5y5rT7DgZg88TKWg6HgWIEtHm/4SPvYk=; b=TlAdl9kykmD1P8xdaBiLP/CVTJil6R0WRqGcjLGa0Xd7IvaLQ5CJNu9qjhbTLlA6lb ML325dhK8IoWKsPeX53W58GFHa5wrUYMu8XTItWGvwquES8Q2sgP1sbJhEq+hVHZnlyI c3kv1DYo487l03dws8dcvqF3PySCv5rZ0Ln7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0/+GpgvuePk5y5rT7DgZg88TKWg6HgWIEtHm/4SPvYk=; b=A6aqjJ8h4Tv3/uxSg/CAlmDk2PoqHTg8ebdnYZMZ3glQcge+pDXpyvMqw53Rt8gxlF QCF5A5VWQAsWLzEYWoePHNpnenTkTDJBUGByGgPh4UBjoNbBNomYmEar7Anuogmi1pzn PllHw6upna9kokjF3AAtP2Li3qfX7q7IOPFbI+ytsynCelxx5K+yBOf655bvu89j90+F 9ZNHaUn8gkFGfqppeAeCWDjUXYg2maIr4Jzo5uuTTSS4fxp+0IrOkwSpo1mQ1dEtnJwC +oFK0pnWPK02ColMx+QuFB4LmbTUV3eTb1GWclwnWJiKTnwqkFF+JEcmRsI4yPb0cpcN 4kLA== X-Gm-Message-State: AOAM532d1i3L0A7EdUznJ94AcMtRKch+0n7kI+XFB6YcVqwu8TKcNOO+ 7e5lTtLlcQIS0XkgnxhGE0TzsA== X-Received: by 2002:a50:85c4:: with SMTP id q4mr123923edh.7.1611249406933; Thu, 21 Jan 2021 09:16:46 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id q9sm2484024ejd.113.2021.01.21.09.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 09:16:46 -0800 (PST) From: Ricardo Ribalda To: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , Jaroslav Kysela , Takashi Iwai , Mateusz Gorski , Andy Shevchenko , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lukasz Majczak Cc: Ricardo Ribalda Subject: [PATCH v2 1/2] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Date: Thu, 21 Jan 2021 18:16:43 +0100 Message-Id: <20210121171644.131059-1-ribalda@chromium.org> X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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] 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; 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