Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp606452pxb; Mon, 25 Oct 2021 14:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0XOV8zbRDVJA14OjlZ/pRX/5Eq28YrM+ZQKjkpJ8VPQt0XKC200fsSCHseYVuRqUplkEc X-Received: by 2002:a17:902:da8a:b0:13f:1a39:e02f with SMTP id j10-20020a170902da8a00b0013f1a39e02fmr19052356plx.82.1635198624791; Mon, 25 Oct 2021 14:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635198624; cv=none; d=google.com; s=arc-20160816; b=ec4y8isWfiGIVNwxictlb4GCL7F1KFMgZUv36J28MD3SkQGttugfq6jGnoQGLDQ9lI axKzLkbyXYJXIeKm2/IC7NgUSA6b7zwZbJT1nvWnSC+tFVPG75gYC0J4ozlQ7KHtGaDb Mflx3ZcYcxqlkq9/bJ0VcjxLN2SalNr5scnXhLkV4hERifUaAQvQQTb6PtkNjRADgcqL OsdjMqOMSYB+roBKDD8T0k5uPejP3JJrRsvCWQ00O5/k7DggbeUMNoWV0YOI6QEyNwWM kmoVhUJQMQzkCQ8Uk3eqZ4eqEY71XO7BXOM3bcKTeDvqwGzRLshznatzsbTbpif1b2qt L1hQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x09AGu+uSoKP/qLyp4Qy600maslV064mTFUlYR35v4c=; b=wDCjQQ56iZSAyly2/VZwXIshxfYK8WLn8eV+frQVJ+4obtzYzSJzMc0Qbl9KCLuHyN 7LpWZK7XV5VWUH6q63lHcH1JDbAIxrNl7C04f+3zvPE/NDjKWdB/zfJQhkC70yF8gfzq Q/EjxZv9B6UjlVwgBcPC53Vc0vMJINz7EkjaVflhQyiAAJwYKWPtroNDjH4zb4hnnQyj 1ob0ci+1BhiVWxDjSGKPFxFc+84OH97Tpu/8+9mVWIHqW2hu0aQ/RLvj+5Feu94W0aoV G1I6fEzoROgTOB0sOGTWasjKzYXIU9Gwq0L2YQHiT7/5LHHINOwcgLaF7t7U4TYp2jAV /ttQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bf0wBVhe; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si30975047plh.23.2021.10.25.14.50.10; Mon, 25 Oct 2021 14:50:24 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=bf0wBVhe; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234161AbhJYRCG (ORCPT + 99 others); Mon, 25 Oct 2021 13:02:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:54376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234151AbhJYRCG (ORCPT ); Mon, 25 Oct 2021 13:02:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88B1860F70; Mon, 25 Oct 2021 16:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635181183; bh=kbEddWIL1NYrAVEh/1ugolyuuvy2YQFqSBjvGQyrqPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bf0wBVheounyFy4nK+AZYdhQhF0UEXhXwPlxQMP7x+tSFB5+7YicujbuUNNncMTNZ VqJaMte8cOAcJWcGQVFmto0KECWvPyBChCFfwtI4hey6xIXVBRwbB34JeiKCrNb71o /VWg1/9L38T2OLMg2QagLBxHFIo6MbU3giFzjp0SdUhuDx86E1z/gFRW/BdHMVs034 I/edG9xmgMD1o1EzC0hrG4aB23HKRgTVpEi5uDoS7I5dgj71y0lqpRfGb6Jj+9h+hI Y7pKr+Zwjb5y7iCAQRrjs/9CW/J2yjIIzAkK6Zk5UeZYpd4FP/3CzYA6cR684DEkDK ZIaXs9uDFQ41w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Yingliang , Hulk Robot , Mark Brown , Sasha Levin , lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.14 02/18] ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked() Date: Mon, 25 Oct 2021 12:59:15 -0400 Message-Id: <20211025165939.1393655-2-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211025165939.1393655-1-sashal@kernel.org> References: <20211025165939.1393655-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Yingliang [ Upstream commit c448b7aa3e66042fc0f849d9a0fb90d1af82e948 ] 'component' is allocated in snd_soc_register_component(), but component->list is not initalized, this may cause snd_soc_del_component_unlocked() deref null ptr in the error handing case. KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] RIP: 0010:__list_del_entry_valid+0x81/0xf0 Call Trace: snd_soc_del_component_unlocked+0x69/0x1b0 [snd_soc_core] snd_soc_add_component.cold+0x54/0x6c [snd_soc_core] snd_soc_register_component+0x70/0x90 [snd_soc_core] devm_snd_soc_register_component+0x5e/0xd0 [snd_soc_core] tas2552_probe+0x265/0x320 [snd_soc_tas2552] ? tas2552_component_probe+0x1e0/0x1e0 [snd_soc_tas2552] i2c_device_probe+0xa31/0xbe0 Fix by adding INIT_LIST_HEAD() to snd_soc_component_initialize(). Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211009065840.3196239-1-yangyingliang@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 583f2381cfc8..e926985bb2f8 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2599,6 +2599,7 @@ int snd_soc_component_initialize(struct snd_soc_component *component, INIT_LIST_HEAD(&component->dai_list); INIT_LIST_HEAD(&component->dobj_list); INIT_LIST_HEAD(&component->card_list); + INIT_LIST_HEAD(&component->list); mutex_init(&component->io_mutex); component->name = fmt_single_name(dev, &component->id); -- 2.33.0