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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E1D83C433F5 for ; Tue, 30 Nov 2021 14:58:14 +0000 (UTC) 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 25D9D2200; Tue, 30 Nov 2021 15:57:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 25D9D2200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638284293; bh=HFbAUNaD+LJF9cQutfU/ONmuoMClbI8nD2pfG+7GwnM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pokZShQPgtTurZKdfFBMnwx9dksVVmQtfqxqoLKh+ImlnGVOBALqz3EIlop4VxiNG RwfcsZ8hzvyui0NC6/OJarvWHbMg8Q4L1dNla/UtWKyOdWPeKa7mBlr42TYAU73HoF cQw7IsCdl+jWOdyMq1x+0Ag0UY1Ns3cWfYgvseBg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8C7F5F80533; Tue, 30 Nov 2021 15:52:16 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DFB31F8053A; Tue, 30 Nov 2021 15:52:14 +0100 (CET) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 83435F80527 for ; Tue, 30 Nov 2021 15:52:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 83435F80527 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CMm+KVgm" 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 sin.source.kernel.org (Postfix) with ESMTPS id CCABECE1A5F; Tue, 30 Nov 2021 14:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E09B2C53FC7; Tue, 30 Nov 2021 14:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638283925; bh=HFbAUNaD+LJF9cQutfU/ONmuoMClbI8nD2pfG+7GwnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMm+KVgmp7rll/+jdhb5brfyXNRWFHKGoZXCFH5LyxDqEoUrT7P/bgYuTFofSIms2 DGCRBGVm4928dxQ+3bFdhC1gOjqBiCZmQDvxkW2D4Rnj9UlC4fK1FmAaS5V+KcyQhx j/+siHWD4DvOHG+P0wGqFt7E49RLTSYcWuU+Jjo/QSuHUDTJ6vICjw/IiTIcamqgMS np8imd308YLp+BqMHxb4RcdsK7Q42PWxIa6zroTTVEwM2BOibtM9koeJLYXs8aNsKe yVd3MxNobaeNXOL+56KtN97W54WDugMuMA5ikFgxxKfxseeLl3qV13daJJwi9YsC9F 85pwcQ75hxIBA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 03/25] ASoC: qdsp6: q6routing: validate port id before setting up route Date: Tue, 30 Nov 2021 09:51:33 -0500 Message-Id: <20211130145156.946083-3-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211130145156.946083-1-sashal@kernel.org> References: <20211130145156.946083-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Sasha Levin , alsa-devel@alsa-project.org, bgoswami@codeaurora.org, stephan@gerhold.net, tiwai@suse.com, lgirdwood@gmail.com, Mark Brown , ultracoolguy@disroot.org 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Srinivas Kandagatla [ Upstream commit 6712c2e18c06b0976559fd4bd47774b243038e9c ] Validate port id before it starts sending commands to dsp this would make error handling simpler. Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20211116114721.12517-6-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/qdsp6/q6routing.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c index 745cc9dd14f38..4c240e9f5eed8 100644 --- a/sound/soc/qcom/qdsp6/q6routing.c +++ b/sound/soc/qcom/qdsp6/q6routing.c @@ -320,6 +320,12 @@ int q6routing_stream_open(int fedai_id, int perf_mode, } session = &routing_data->sessions[stream_id - 1]; + if (session->port_id < 0) { + dev_err(routing_data->dev, "Routing not setup for MultiMedia%d Session\n", + session->fedai_id); + return -EINVAL; + } + pdata = &routing_data->port_data[session->port_id]; mutex_lock(&routing_data->lock); -- 2.33.0