Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp410636pxb; Thu, 21 Jan 2021 09:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkEkRHLX4HsCVwAEjaaQZfBS/iqNJtF9K6cnenmmDr6B08DFUQQBw/RHnaRiqBHimjLS9J X-Received: by 2002:a17:906:68d0:: with SMTP id y16mr478283ejr.128.1611251763760; Thu, 21 Jan 2021 09:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611251763; cv=none; d=google.com; s=arc-20160816; b=1AEibLwJAngQfSZJxkMgcpIeRLPEvBfwixdBxOusyqMmbrJ2BkplRbSstsB9+PDGF2 HgYKid08p8OLWBCoBQd1Qcxei61N4xcAFm/6MCxEpmjcVi/XjlvBoNLXI3UiS/3kuADk VdX+bI7LB0FAwsFq4HwnAGaHBGADpgZ5mCuuHUmuDVM3/fPuoUFX09opNGSBKDychWaK p+tMPyyxFhmnrhqZBZgbLlstGV2AmXkZeFX4jKZAcEIZS1DID+ydbSgB8ofMytQoeWIg Hj5UGEHlnvRm2pWrrF4+Y3d8MzE6vdM07a8ftL5QxTq6axz/Dq0ZXkyOdNAiqXshgnmT 1wmA== 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=51VcyZ0wcuGuW2m213F8YE94gBtxdpp+DVm+1XUV/kc=; b=RivUKvGWihZK/7WU0jzQzz+4diffe6hJqcZGfuoR5i2VrAEsN7xxj8WWrqunzjU1Ya 7IqhcaNJuUAO9RoVOvZY1y4/Wv3Bkq0RjdocJmkJ1DUeu19p1qihepBgSb+dLR7IaAbH APC/e9PD5qVD7XYXK24SMIk9+jEoYqZF4MmH25BouVP1OKy6eRauSfgXllA1mIsZvUx+ 1AH8QLKS5o2dkbcwoxYg9RxkOh0wyfBZN0GTZEOFXuU2MUNxQmo35E768tJVja3RwUwE iWu7DNRVE0oMTqhsCH1p8TK+jnbs9XnbXz8j/3/FXWvHlopRjYtZRBgCOE9hgNAJoc9I sK1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=H5RbvKJz; 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 qx12si2028610ejb.375.2021.01.21.09.55.35; Thu, 21 Jan 2021 09:56:03 -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=H5RbvKJz; 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 S2389294AbhAURwt (ORCPT + 99 others); Thu, 21 Jan 2021 12:52:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389054AbhAURwh (ORCPT ); Thu, 21 Jan 2021 12:52:37 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6CAC061756 for ; Thu, 21 Jan 2021 09:51:54 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id l9so3878519ejx.3 for ; Thu, 21 Jan 2021 09:51:54 -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=51VcyZ0wcuGuW2m213F8YE94gBtxdpp+DVm+1XUV/kc=; b=H5RbvKJzOAZSzZttqk+4D6J5otSROP5TEODNUwb21iPJKfP+Ab3VInvWrEmmIXc51D kT4vXcIGucGm/xDXGd5766NQhpstAG53Q8NLEmg4cvuF7NJn7NI2aqKPPNarNCatpphL n04UttoRPSTulyYrFLysFiGhqiFnUg2Vsf0CI= 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=51VcyZ0wcuGuW2m213F8YE94gBtxdpp+DVm+1XUV/kc=; b=O4HCZ7mYKduYgP7avcEyQi0b20SyI/aGrUsYMpEKVyrY/2PPgbVJQzveDnj42wFXQY qNsHzDMIhJgPJ3SVuxgUbiidZfxw5CHfSlKfLdWzFJRvkjQ+GyQ12aNCWx8s0xajyboc I0KOMMmBlrEPipS+Gcfsvth46CvKomwi1L7J+SYgYbwG97LPV1rZ5BSdV1REeYL51yxx YQrTy778uWrTmZfxnnOO7vP/bd6bunjtylhi0Zn7WyTMzqgo0g0F6JjWiTFXJQph2r8a /6lBkFWbn0fJtn9CnnEV7qrq6BUbu1z60mBj5t50oaDtue4hywSgGifDnRGhm96P+J3z 0ncQ== X-Gm-Message-State: AOAM533m1k5kht1N8PjejMkxOVdUePPJHmRFXFJ2cdW+3vaUta86APWK JawuDipSzlM7mnCTWkaApN/HpQ== X-Received: by 2002:a17:906:4893:: with SMTP id v19mr421764ejq.454.1611251513363; Thu, 21 Jan 2021 09:51:53 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id w16sm3232349edv.4.2021.01.21.09.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 09:51:52 -0800 (PST) From: Ricardo Ribalda To: Andy Shevchenko , 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 Cc: Ricardo Ribalda , stable@vger.kernel.org Subject: [PATCH v3 1/2] ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete Date: Thu, 21 Jan 2021 18:51:50 +0100 Message-Id: <20210121175151.139111-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] Cc: Fixes: 2d744ecf2b98 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHL") Tested-by: Lukasz Majczak Reviewed-by: Andy Shevchenko Reviewed-by: Cezary Rojewski Signed-off-by: Ricardo Ribalda --- v3: order local variables by length 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..ffd37aaecdf1 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 chan_text[4]; + char **texts; - 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