From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382313; b=w2ri3DEGwfi4ra5ymb5AlLUvJcYZOBkJ5YkuMbMn8AFWG7BRPa2q74eBX/YaVRHbBm9n AI3n3ZVWACbxMJsJQbuOupSwffoL02ylWDL+QF4QPqWe4HMaOqxfgv4gMo0MKhnyV1ax9 go+BSMeuho8xtNouuInRJvn130plqbBmie4BG0uOhc4zKYUr56Q/KonO37KvgpMf830W8 XpFKPWRpziq0Q475V1KFWnJnVNNS6qoP8AkTYQ+L3UBKtaGeG3FvwvFBDwLxQmBseO3mU mVG09+kJUXxLibE9KBtdtUC+/gvWsx1JFn3MFI97XXcLnBxuMpB+y4JAsC7YBQJxn9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382313; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=eertV/A339M3cvAVbUqWrdHQinW315m54uG1fujckoY=; b=QPyMP3JlXnMz+jzC0drxNcfNAsO1cmJU1q9VF4IsNWv8mHj0BlZJvjJ0+3gvHkqqGOjf Trp0MGYVRElXR+WrtjqGfIYLQNTQuGZ2MmZr8tPQKkP/6rDaIhILPvOffH0yh9Pm04YPz /+CVyYTcqXm6E+NPLcCj1EsUpoQq3STchM712aesdJJfOQlAubKHHZsrKIgA3EMJHq4zM SJlFpo0Vk1ClumIpBvuzyxRZnpBsZ8T2h7Dv8CPhktUQxyMrGvCefbPDrTU4BXp1/757w /YU5zCrVy8smqKrxWJoGdmqpfJdbffj9I2RUoyA9sCwKPDNZJoGobD7FVqRQOasDazw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="e46/Me5E"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C5A6606A32D; Fri, 4 Dec 2026 11:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=e46/Me5E Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11B041F000C2; Fri, 4 Dec 2026 11:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382313; bh=eertV/A339M3cvAVbUqWrdHQinW315m54uG1fujckoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e46/Me5EEtFV0ZMAmKb3T16YE+JZTuOtrCYLXVgfpIo8AWR/WK9fil2AG3YCu/535 8ZtIFrVkQwjs5O8cqegLHeFyyXxkvl6aTwBCr1QJhr+Ba/f1bMBvJwHP64RiX6EgMB j9jDUCwomMql8PeBip7giM3XB45VuoRDh9rHh7Ow= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Julius Bairaktaris , Mark Brown Subject: [PATCH 6.18 399/703] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:04:58 +0900 Message-ID: <20261204100638.442390718@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julius Bairaktaris commit 4c15e549b7ad03183d10826da91e9ddc207a02cd upstream. q6asm_dai_compr_open() allocates a fixed 8 MiB DMA buffer, but q6asm_dai_compr_set_params() takes the ring size from the fragment size and count that userspace passes to SNDRV_COMPRESS_SET_PARAMS without checking it against that buffer. The compress core checks the geometry against the runtime buffer only for drivers without a copy callback. q6asm_compr_copy() places each write() at the stream position modulo the ring size, so a ring larger than the DMA buffer lets write() copy user data past its end, and after SNDRV_COMPRESS_NEXT_TRACK the copy starts at the next multiple of the fragment size. Reject a ring larger than the DMA buffer. Fixes: a08cd56a4524 ("ASoC: q6asm-dai: add support to copy callback") Cc: stable@vger.kernel.org Signed-off-by: Julius Bairaktaris Link: https://patch.msgid.link/20261111080624.244291-3-julius@bairaktaris.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/qcom/qdsp6/q6asm-dai.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -886,6 +886,9 @@ static int q6asm_dai_compr_set_params(st return -EINVAL; } + if (runtime->buffer_size > prtd->dma_buffer.bytes) + return -EINVAL; + prtd->periods = runtime->fragments; prtd->pcm_count = runtime->fragment_size; prtd->pcm_size = runtime->fragments * runtime->fragment_size;