Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3292732rwa; Tue, 23 Aug 2022 02:08:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4fL/M5fc0KqJ/7S1xpCoxcNX4mInTZSHSaS8XHpYxlvnuILEbpXCJWzb7VpynK+EqZ8ZZm X-Received: by 2002:a17:907:3f98:b0:730:cfce:9c0f with SMTP id hr24-20020a1709073f9800b00730cfce9c0fmr15896563ejc.475.1661245690688; Tue, 23 Aug 2022 02:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661245690; cv=none; d=google.com; s=arc-20160816; b=plPJfUDcij7W/uXxKg7vFXks31QeAlZhkZKZ5MfphytZWvgrzISyhYbG6JM0z/YmQp zpQVBJwkoVaCNPL/fEcX6uqTDqkJvX79eqtd41oXAkVcfNqCXmd7Jwt2+MQJI2n7Eupt pAudjw5jxzG8FaYUeGjA9iS5sl/TelZ48RTpRozmSVlUqR7hpQbMfQiL2z4XVFV+0zWD Xag2lLxK3gLhvDQdqS/kEqZSTxWVVZj5wZljzqJHdcOmNdQWZmKbPio+byvepIEowAaQ Gq+gcZSedk5ZykhAngKhlgTd7J/u1Yq/kE/SvC4Gxm0+vINgx35CbIFT3pKZGrobu2DX bY3A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ndq3S640cCEfGEXnJINUYq1GKbHOnSDSwhqHBfNgVvE=; b=eCcwYKM2ujdhrYkoU5p+ger1MoaJP49GVoLA+lmQunlLP69+XiHVoVWx0/TcnLwnD/ D0TooIOS9I6hKp41ZClj9PO1A7nhioChpDMX553DRlJVrOSwRWVFiZNocyUMajXvRzfn exUj76Jqs7RadIcfnRMdG5fgxrCRJQkfW2S+3wfyJZPwtpWFtzGmpeNbX26e1Wd9X3IE 5oxUNG0erQl8l4NfdGuqP2daSoob6eaZKyNpdHAi4j1hrw2tMtvtq4wXy3Sq2JA2ExZz JsDc9o4naOrSokZlwMd6MwOT8ijCo51ht5CLQSP78YryTEZuijMJVNSvhewWyET510of vPKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m9PE/qoG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq10-20020a1709073f0a00b007308bf614f7si14723987ejc.512.2022.08.23.02.07.43; Tue, 23 Aug 2022 02:08:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m9PE/qoG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346868AbiHWImv (ORCPT + 99 others); Tue, 23 Aug 2022 04:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345619AbiHWIkH (ORCPT ); Tue, 23 Aug 2022 04:40:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148FB32ABB; Tue, 23 Aug 2022 01:18:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76C60B81BF8; Tue, 23 Aug 2022 08:18:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA6F2C433D6; Tue, 23 Aug 2022 08:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661242719; bh=4dsBFVq/EY4Vczb4n0x3cAK3E7FUpiE5oSunj5mN74A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9PE/qoGqpmnrjviWhO6XPE9QpdxEDfuwrqtY7q1Y5djMHLqyu93sti8cIxP7ozH5 PRpPV49jO6o8wdhrt6re6hkC/wr2iCyYB0EAP/fT44j7/YCaZkRc8k5sPyDbWUtlsH 5mH4ibCi/CepkNEzi9spss/UDYVawjpsl8aolGc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Natalsson , Pierre-Louis Bossart , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Takashi Iwai , Mark Brown Subject: [PATCH 5.19 179/365] ASoC: DPCM: Dont pick up BE without substream Date: Tue, 23 Aug 2022 10:01:20 +0200 Message-Id: <20220823080125.709580979@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 754590651ccbbcc74a7c20907be4bb15d642bde3 upstream. When DPCM tries to add valid BE connections at dpcm_add_paths(), it doesn't check whether the picked BE actually supports for the given stream direction. Due to that, when an asymmetric BE stream is present, it picks up wrongly and this may result in a NULL dereference at a later point where the code assumes the existence of a corresponding BE substream. This patch adds the check for the presence of the substream for the target BE for avoiding the problem above. Note that we have already some fix for non-existing BE substream at commit 6246f283d5e0 ("ASoC: dpcm: skip missing substream while applying symmetry"). But the code path we've hit recently is rather happening before the previous fix. So this patch tries to fix at picking up a BE instead of parsing BE lists. Fixes: bbf7d3b1c4f4 ("ASoC: soc-pcm: align BE 'atomicity' with that of the FE") Reported-by: Alex Natalsson Cc: Pierre-Louis Bossart Cc: Péter Ujfalusi Link: https://lore.kernel.org/r/CADs9LoPZH_D+eJ9qjTxSLE5jGyhKsjMN7g2NighZ16biVxsyKw@mail.gmail.com Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20220801170510.26582-1-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-pcm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1318,6 +1318,9 @@ static struct snd_soc_pcm_runtime *dpcm_ if (!be->dai_link->no_pcm) continue; + if (!snd_soc_dpcm_get_substream(be, stream)) + continue; + for_each_rtd_dais(be, i, dai) { w = snd_soc_dai_get_widget(dai, stream);