From patchwork Wed Mar 30 20:19:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555125 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 9373FC433F5 for ; Wed, 30 Mar 2022 20:21:30 +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 AEEFB1AAD; Wed, 30 Mar 2022 22:20:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AEEFB1AAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671688; bh=v1AKXMhBFfjEwWOxrOxven0a28qinAa9HORzeGn2m/c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SYpDGXnL2L0zUOK3RRF3MeIF+QnD4t7sslSLd1Foj6zA/UBVV71iB9i0BT7WwZyH0 zTkLBBI+/jXW54fmPEBO3+HIN5JvqzvM5Ck8BFYJRG3FUhaNLwYpCheTi3oSyx0zNi B+xWirakkoTazoixhOvGvy0vi2wOmQSN7g1bxWqQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E7479F80254; Wed, 30 Mar 2022 22:19:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 25FC1F8051C; Wed, 30 Mar 2022 22:19:51 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AE387F80254 for ; Wed, 30 Mar 2022 22:19:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE387F80254 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JffgXHXq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671583; x=1680207583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v1AKXMhBFfjEwWOxrOxven0a28qinAa9HORzeGn2m/c=; b=JffgXHXqnCdY6KReLyyDra9y5cgsldbKPdT7RA1/pZNQdNGYyqa1VhdD AvyBn812nUDsm5b5sbbR7rtHzNbVB+3i/51IOckVCyaEI8hoX43xYMXFO iSw/Aw+PtsMs9BJvy1HOS/hzfigmVZlYQfjJi0wxHaK+Ik0kgIJrTyQ9I XyAmdVGJuxc0SoZwkfwEAI/9sM4H7xuPjCIHomAlIu+2T+7bK03GgIGkg PQGCUHbyfpoJPH5qkDAI8/3NbfwlTdqWyXV4zkoe19+VTMYc5JqsEvbOn fI2bMTSue90pbSWap+O/Iq81bxTRX6zsyeYsbZb6t+tklBuK/jiHFhXri w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819828" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819828" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045026" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 04/11] ASoC: SOF: ipc: Use ipc->max_payload_size for message/reply size checking Date: Wed, 30 Mar 2022 13:19:19 -0700 Message-Id: <20220330201926.1330402-5-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Daniel Baluta , Kai Vehmanen , tiwai@suse.de, Peter Ujfalusi , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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: Peter Ujfalusi Use the ipc->max_payload_size for validating that the message or reply size can be supported. Signed-off-by: Peter Ujfalusi Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Reviewed-by: Daniel Baluta Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/ipc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index af2efc1c8436..166d4906698b 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -373,8 +373,8 @@ int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, { int ret; - if (msg_bytes > SOF_IPC_MSG_MAX_SIZE || - reply_bytes > SOF_IPC_MSG_MAX_SIZE) + if (msg_bytes > ipc->max_payload_size || + reply_bytes > ipc->max_payload_size) return -ENOBUFS; /* Serialise IPC TX */