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=1796380826; b=d/r1KgflzFSXGURfalEUJzPuA2UmRFKr2U8fRK57ZEhgozJjvPpE9ihMdQGItsSJwVyy sBzPGKVIjejEstZ+fTrkZX3Cwd8+tOFEsQTv6Nb4ytqdsu9BxgDpGDAKiZ4RmIbKxI0B4 E2/jA+7CRI+1MKHUyJz7dV/gISO1TFo/PJc0iyb0EYBCEjDaYJno4dt+VivVyghVumFhm U1hoQVEpCzirr2Lci5Qbam9wH8NLFr+FQ/TTpXBlwR665JFRz+6N570nXzxDrqV8mkSX3 /cHknsAt2CSsdK6gr43uIIEZaEJfiu34Ehv1ThapM1Pqm6nztUfDWkP8iVF4w8j0IOg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380826; 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=FoPQ312xew9dLFwm0s5eOpWcnnnudTXPKzJ8kzgjRPA=; b=BwKK3HYLGNV2lH7bnDgv0tH6JnSNME9LB97QlSXCFQsWpxgpZwwARWm+eF7YP8dQ28Tn AVUZfDwNQk06RXyTCSaGRBuvSk5MQbECLHlKrQXyrcbsYCHLutmZj6TZDdxwaMgdHAp0Q nMsct0rFfam1ntH3nSL3xz/zHJrlx9oRNltVB2ZHdwGAQvyNqDQF1wWCxJAFqr5UKACH/ Hse1wzIhMQbOzuOwRKGdPwr246YmkxArgH1QurvKnzYxKW1M8l1IT81ItAogsYGU0vEOF tjTiHl2M74TXIFI0uB0AuU4ITSFZ1q3+rVy5xCcKczlF+ZyBY0ylW1YnNkBxd+ciPog== 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=yOPTBcoQ; 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 EFCBE606A322; Fri, 4 Dec 2026 10:40:25 +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=yOPTBcoQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 659381F000CE; Fri, 4 Dec 2026 10:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380825; bh=FoPQ312xew9dLFwm0s5eOpWcnnnudTXPKzJ8kzgjRPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yOPTBcoQ6DfTqQ0PjGIUjZXgMLrlSR1n7/84KOME8DC73ukYbKPMGrSAmtMYaEASh Na+NVErblZogVYXBsObbDft2bocNuEoEiImP/G/jS1H7llP8XA1/eI/WGU4QWFsHnR FODEAZW8GVZntyo29+FsmkzeMTrFJRCjAJzx7r9s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Julius Bairaktaris , Srinivas Kandagatla , Mark Brown Subject: [PATCH 7.3 438/742] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:05:02 +0900 Message-ID: <20261204100646.746861250@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julius Bairaktaris commit 3857bc06e5a40c5ebb62917147375a811f010aa0 upstream. q6apm_dai_compr_open() allocates a fixed 8 MiB DMA buffer, but q6apm_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. q6apm_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: c317d148a2b0 ("ASoC: q6dsp: q6apm-dai: Add mmap and copy compress DAI callbacks") Cc: stable@vger.kernel.org Signed-off-by: Julius Bairaktaris Reviewed-by: Srinivas Kandagatla Link: https://patch.msgid.link/20261111080624.244291-2-julius@bairaktaris.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/qcom/qdsp6/q6apm-dai.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -827,6 +827,9 @@ static int q6apm_dai_compr_set_params(st if (!pdata) 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;