Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp50781pxm; Wed, 2 Mar 2022 10:13:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/jjTU2i34OlE4ewgb4jwjSSdMJYDsfoWs9hTH+Idhg2pdwE0YbBEgrLyMjMzlZ7tPmLqv X-Received: by 2002:a17:906:c0c:b0:6ce:e59c:c38a with SMTP id s12-20020a1709060c0c00b006cee59cc38amr23686052ejf.483.1646244785348; Wed, 02 Mar 2022 10:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646244785; cv=none; d=google.com; s=arc-20160816; b=QSSuF0oiFDFu+phxBRGG+VLD1zgs9jWNVRrrLkEtiPaf2zo2/8sEY8ATu6wol9fK9J +PA8JKLsacPBp9AXDN1pCmZPW+Cq72ujdDkL50Mo6CJmkKmfwTdyIQGedryn+TYKRO9x q1U6lihvmR4IEqOjSCqhMoPw12gRyOFwiXA7NyJJvRaLuiHEMgIvfaGbBuyYITaX54Zq pLMsXX4JSqj9D0QLNz7HmHPzOnz5I5Lhn+EGunzKsX4k+p6Qmam5KP3tK/p+l1QGwi2a mLF8CX9+GVJGhhW1VcKRbYU69HIlUXxfvvfjLQ/L67NsKS1O2N01zjBD9U5+kpbcNrfg zvKQ== 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:date :message-id:subject:references:in-reply-to:cc:to:from:dkim-signature; bh=r1x63rGrQo29AsRHP6HsnSzX5z+lclvdPe2YZfkBtd4=; b=DRpXO8ScePW3KoHpF9TgSVIcPtjtp38N4PN1HU8Xe1zYD5D38HjIhYFuTkIsMHMipp 2lSFnKGNZfmSwzKLDqlJRiSkZUwnCYgiH/KOfVHQhgyZTvdylZZcpGs/+nkSKj/wvjeH hVO8EhTc2tPbiRsrih2kCqaGCdKA77R55WgaL4QtKYOk9jD5QslQ5hdoptJs3FwCr43X gv8iXLNgDzdy4PAM37sYImVLL/2BOgL9/80K95SLEOWORRN7H+2FzdQS7CV9OmJ7JYC6 WB44A187wf22ygdcNyzymAA8Uvfv0AjR12jwmF3y6geHnDeGmsPGP87bud+dkRDXXfTA 2stA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJEjh3bL; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw35-20020a1709066a2300b006cf65c4495bsi11386023ejc.57.2022.03.02.10.12.41; Wed, 02 Mar 2022 10:13:05 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=BJEjh3bL; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243592AbiCBRBs (ORCPT + 99 others); Wed, 2 Mar 2022 12:01:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243586AbiCBRBo (ORCPT ); Wed, 2 Mar 2022 12:01:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DB24C3C30 for ; Wed, 2 Mar 2022 09:01:01 -0800 (PST) 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 F3B2EB82105 for ; Wed, 2 Mar 2022 17:00:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48857C004E1; Wed, 2 Mar 2022 17:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646240458; bh=MfDFBAyKZO8R+BnzZBCZPZLZ/sz34eRmK3kYoi78u3o=; h=From:To:Cc:In-Reply-To:References:Subject:Date:From; b=BJEjh3bLaS0dc3swhCdMxhIdLYODlOvGEs+1zBqVQ66qi9Mm/2WTNmeQzSPNrhFSr AeTlcYCPQ8RNTiSosUZC1IMQo7OmBGx1kF/tsPql49/54EDMrqy8wvsUcsZetY6GWV J9e+NqS0KMk7Ay52HsWjIISnnET1ESiSUNKdt8FExVSTcDoZCEQ1Un0qiYMgTZXSYn JqDrP34bw5nqSR15kdNT3WwShZHLPjTWBQ71RAtiuvBNWKravnJ5jTPYWdikHuHlFI emsY10enmP7yUxRTuyEwsr8D3EKoiJOVUw6I3zRGgy6iOd7O78o2Pe5tntsg0E9v/9 JcdklurEh2jOg== From: Mark Brown To: lgirdwood@gmail.com, tiwai@suse.com, perex@perex.cz, Jiasheng Jiang , vkoul@kernel.org Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org In-Reply-To: <1634285633-529368-1-git-send-email-jiasheng@iscas.ac.cn> References: <1634285633-529368-1-git-send-email-jiasheng@iscas.ac.cn> Subject: Re: [PATCH v2] ASoC: soc-compress: prevent the potentially use of null pointer Message-Id: <164624045702.1145067.14385834637074739247.b4-ty@kernel.org> Date: Wed, 02 Mar 2022 17:00:57 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 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 On Fri, 15 Oct 2021 08:13:53 +0000, Jiasheng Jiang wrote: > There is one call trace that snd_soc_register_card() > ->snd_soc_bind_card()->soc_init_pcm_runtime() > ->snd_soc_dai_compress_new()->snd_soc_new_compress(). > In the trace the 'codec_dai' transfers from card->dai_link, > and we can see from the snd_soc_add_pcm_runtime() in > snd_soc_bind_card() that, if value of card->dai_link->num_codecs > is 0, then 'codec_dai' could be null pointer caused > by index out of bound in 'asoc_rtd_to_codec(rtd, 0)'. > And snd_soc_register_card() is called by various platforms. > Therefore, it is better to add the check in the case of misusing. > And because 'cpu_dai' has already checked in soc_init_pcm_runtime(), > there is no need to check again. > Adding the check as follow, then if 'codec_dai' is null, > snd_soc_new_compress() will not pass through the check > 'if (playback + capture != 1)', avoiding the leftover use of > 'codec_dai'. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: soc-compress: prevent the potentially use of null pointer commit: de2c6f98817fa5decb9b7d3b3a8a3ab864c10588 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark