From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7213213D896; Tue, 23 Jul 2024 18:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721760231; cv=none; b=kiqE1isTnlDoDdhktKzDps51FFDBfZ0zHI1tnzKQxIEGfMziCH/LJpkjTqitq9Z0o9Mh7lU6rb+SHNxTonS2Tow4TMACq6rUkPHt1jm9xcbnbKy3W/4MnrkJpvsTwV0UAJ9woMIVb4UyRLsXwDbL2KCfLBecTL+hxJ6TUx8soQE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721760231; c=relaxed/simple; bh=S5/WaCQoMJdImtCQtfkMO8hv/Eg2uh85tBVEhPEOrVQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nPeD0FE/p35hbgwGJ7+bPmXfDbVIugwDj5QMo3C1vJ1KXjWYeTdD1ix0UuUeTnCzFV1h2Z3Ec8Ohqjqi59yimywKnLjg3uJawarGiNhQIlQ38D5qvfPQI0oKPc9VMw4RyZ8snjfb3B0tZNAc8U1sqtXXCxZ5ZyZkGLKLEoh0AT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RLN8wTlA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RLN8wTlA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECDACC4AF09; Tue, 23 Jul 2024 18:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721760231; bh=S5/WaCQoMJdImtCQtfkMO8hv/Eg2uh85tBVEhPEOrVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RLN8wTlAo2sB10bwMiQmcV+t5/8TYgiP6g2j9CnXNOr15KpE4E3qta5HK6tx8vhIn dkfI2h0GHjCTKhMw2jouNmtKJ1jwR+qq3h+AlmOS1FzjrsB6W9RtDfJAUwwfJ5mXur vSFX8WR391O108r3K8cmMsZxu5W6qUFChSzL8f8I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Ujfalusi , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 6.9 147/163] ASoC: SOF: Intel: hda-pcm: Limit the maximum number of periods by MAX_BDL_ENTRIES Date: Tue, 23 Jul 2024 20:24:36 +0200 Message-ID: <20240723180149.152298643@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723180143.461739294@linuxfoundation.org> References: <20240723180143.461739294@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Ujfalusi [ Upstream commit 82bb8db96610b558920b8c57cd250ec90567d79b ] The HDaudio specification Section 3.6.2 limits the number of BDL entries to 256. Make sure we don't allow more periods than this normative value. Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart Link: https://patch.msgid.link/20240704090106.371497-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/intel/hda-pcm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c index d7b446f3f973e..8b5fbbc777bd4 100644 --- a/sound/soc/sof/intel/hda-pcm.c +++ b/sound/soc/sof/intel/hda-pcm.c @@ -254,6 +254,12 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev, snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS); + /* Limit the maximum number of periods to not exceed the BDL entries count */ + if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES) + snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, + runtime->hw.periods_min, + HDA_DSP_MAX_BDL_ENTRIES); + /* Only S16 and S32 supported by HDA hardware when used without DSP */ if (sdev->dspless_mode_selected) snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT, -- 2.43.0