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=1796383771; b=QxI6gic3qcUNMyKZS5Zo2FudC3DAi7VEGEf1ZC/Oew1CKjwz2INclbPj0P3b3a0JaOpr j4COkN8vrOW+IM//7M1hk2kOmuqcCTkWTA+B1jd89VzINyLPzAcPM5UamXlwu1qpdjTr6 oD4zCrI3ZK5NfPs2wsfXqbxuNq0ncjVauccYoC+oa/PkBnzu0N9BlwBiSkCSdY6rYTDFP 4AFSYyKg3F8OzAmjBX2Gpg5tfSD+/1FC0vYUam7bryIp4fgUHnzZ0pgem0LMmCCl0k5rV jMUaND2bM5/JawVDAbHSHkzommGwYca1ByznMDixOgvgzAd8MF3NIYs3e7rRqkkg+nw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383771; 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=g5ppAr+DKUEEb9VFo0ElSdylo4UQZbQxp7uushMf+IY=; b=y8TDi60uXZR/ofb3BuV0Dk68z0tuke0hK1cvGJyvo/daNk7IQaGGE2f7KZSgViuvIFYl qrU96AjmGMDCSUjjWq0ypcZGSeOMDQdaUDHk6ncnDNXWefWng70qMsTDH+tU6YBDdLpqv XDBmtBXOxwUdTX9iwq1uoxSxBlDQQFt30KZKP8JYWGlbbnOCuR9KThAYNum8Ix0aLldRg /JJT6hxxphMIUfHEgR12tCGDtXY1WriZBKhgrCrNr5wCO4FWnHvN3UGMH7cb0S/enRNF+ 9PeePX1cK95apXtd3ZddkGfIIUjIRAgLIbcBl7ED3PcxE4YaFIF3CrMTsFuWEspjwpA== 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=Fhk0Zpwf; 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 795F0606A322; Fri, 4 Dec 2026 11:29:31 +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=Fhk0Zpwf Received: by smtp.kernel.org (Postfix) with ESMTPSA id E062D1F00897; Fri, 4 Dec 2026 11:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383771; bh=g5ppAr+DKUEEb9VFo0ElSdylo4UQZbQxp7uushMf+IY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Fhk0ZpwfiLBI1a/sTRoOGRJuW40IHip8oYnlxr8bbDqu+SqsRFbNwzCpFpb55l+un HE9L/O8yaMsmRN6esP3H44TbyShTWN+bINLIprdfkjuDfLNvZVCr8gZzlbBjeSmVj/ 4BPzCs/tA0NmVmw9K0Vtk4kwU97lWjcf0R2X4W5s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Julius Bairaktaris , Mark Brown Subject: [PATCH 6.12 360/555] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:06:43 +0900 Message-ID: <20261204100623.579049018@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 @@ -885,6 +885,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;