This is a note to let you know that I've just added the patch titled ASoC: SOF: topology: Fix logic for copying tuples to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asoc-sof-topology-fix-logic-for-copying-tuples.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 16df1d990f7ad1db15f1c26cb9da8b63155dc930 Author: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> Date: Fri May 12 14:46:30 2023 +0300 ASoC: SOF: topology: Fix logic for copying tuples [ Upstream commit 41c5305cc3d827d2ea686533777a285176ae01a0 ] Topology could have more instances of the tokens being searched for than the number of sets that need to be copied. Stop copying token after the limit of number of token instances has been reached. This worked before only by chance as we had allocated more size for the tuples array than the number of actual tokens being parsed. Fixes: 7006d20e5e9d ("ASoC: SOF: Introduce IPC3 ops") Signed-off-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx Reviewed-by: Péter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx Link: https://lore.kernel.org/r/20230512114630.24439-1-peter.ujfalusi@xxxxxxxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 9f3a038fe21ad..93ab58cea14f8 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -586,6 +586,10 @@ static int sof_copy_tuples(struct snd_sof_dev *sdev, struct snd_soc_tplg_vendor_ if (*num_copied_tuples == tuples_size) return 0; } + + /* stop when we've found the required token instances */ + if (found == num_tokens * token_instance_num) + return 0; } /* next array */