From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19834C2D0DA for ; Thu, 26 Dec 2019 08:51:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 297972080D for ; Thu, 26 Dec 2019 08:51:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rv07SOOD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 297972080D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id F045216E5; Thu, 26 Dec 2019 09:50:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F045216E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1577350272; bh=mD2rP/m+e8i3OEecbBTShsmtBbMyYVRA/5Ip6ikg/fk=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rv07SOODSG+VZzxHU4qjOkcWyOi8+YZP6Gnur0/X4XRM4Ta+ixq7VxDfXUA2cCaa3 v9vlFJISS8icoJ4+Wijo5psR6QmoBTEbl+u1bYellCFX38rk08Zn8KgBtqHPxKdeZu xh2fdWzT4egvhWCMRpJX22BdmAKWNittkhkQYhUo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 76E33F80138; Thu, 26 Dec 2019 09:50:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E8527F80139; Thu, 26 Dec 2019 09:50:19 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CD6A9F8012E for ; Thu, 26 Dec 2019 09:50:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CD6A9F8012E X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5CAFFAC37; Thu, 26 Dec 2019 08:50:15 +0000 (UTC) Date: Thu, 26 Dec 2019 09:50:15 +0100 Message-ID: From: Takashi Iwai To: Mark Brown In-Reply-To: <20191204151454.21643-1-tiwai@suse.de> References: <20191204151454.21643-1-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] [PATCH] ASoC: core: Fix access to uninitialized list heads X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 04 Dec 2019 16:14:54 +0100, Takashi Iwai wrote: > > The error path of soc_new_pcm_runtime() invokes soc_free_pcm_runtime() > that may cause a few problems. First off, it calls list_del() for > rtd->list that may not be initialized. Similarly, > snd_soc_pcm_component_free() traverses over the component list that > may not be initialized, either. Such access to the uninitialized list > head would lead to either a BUG_ON() or a memory corruption. > > This patch fixes the access to uninitialized list heads by > initializing the list heads properly at the beginning before those > error paths. > > Signed-off-by: Takashi Iwai This patch seems forgotten? 5.5 still suffers from the mentioned bug. thanks, Takashi > --- > sound/soc/soc-core.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c > index 0e2e628302f1..726e5de850c4 100644 > --- a/sound/soc/soc-core.c > +++ b/sound/soc/soc-core.c > @@ -478,6 +478,12 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( > goto free_rtd; > > rtd->dev = dev; > + INIT_LIST_HEAD(&rtd->list); > + INIT_LIST_HEAD(&rtd->component_list); > + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); > + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); > + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); > + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); > dev_set_drvdata(dev, rtd); > INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); > > @@ -493,12 +499,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( > /* > * rtd remaining settings > */ > - INIT_LIST_HEAD(&rtd->component_list); > - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); > - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); > - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); > - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); > - > rtd->card = card; > rtd->dai_link = dai_link; > if (!rtd->dai_link->ops) > -- > 2.16.4 > _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel