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=1796383769; b=ZGKOvee0aEKedOpCVResqc55GwFDkUljyHjo2dThqGzXqNlwjv97WFVvDinOUghhtvnM ECVHE6uHMwhpphSgyiKC2mUJJsZ76yl8P19PRxSxBX3umyO3Tv9bF2QSmqqsTSdJe6YvJ n+BARZvZxU+JCoyJNQYWuM1ypVtx6xhItHSpjvWuu30KeVLK8KqttHiitVLydjFE75kyZ p00/1hcRwoldl/SNcKALv2nWMfUX+w8Q/dEpTMaScTHaDSH70Es5YtWdLGBasmx3VlASA BQN6os22XGGIl+XUNlZrQ5Ug3Wj9gxV1mYY8l4lhWw06B0SIzc3ZCqVe+hsBsEFYDnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383769; 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=qiMMktaOnGruPQo6lYMgvUggDwHovOAw1cWoL9gaHCY=; b=JrstS/jt1oZHao8a0WWfkm93Hm2iQIURGRu+zq11qoJqptzGs8YgJNRxefKoyL1ZJ6yd hcKzH1SeWB8RjxVfvWr/v7zFGwfjO3+ntTlpgYPgY6YS4UImJsd6YqAYz4ecds98mZ3zW lzPegAV9msCa6ynUA+p2EiXujPgNyELlqT1ZyUxWkegL8w7ZmpUPHgSFdsNYeq3jHFYRY S4u93zn5cv8jtUjDMcF8SZVnq3gxzOqz8PF+sOR7WtTmHe7VJDkTSjLRXcFiiJklHfuQg 27HtBz45qOlYmoXFrd/ooIwTxEslIqmNjk7uBIGeUFAIVguJ+5U8/I3XMX8tP6Wt2jg== 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=DmsvuqSy; 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 380E8606A322; Fri, 4 Dec 2026 11:29:29 +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=DmsvuqSy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E25C1F00897; Fri, 4 Dec 2026 11:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383768; bh=qiMMktaOnGruPQo6lYMgvUggDwHovOAw1cWoL9gaHCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DmsvuqSy2O4a+mo9qvPOO8v23JZMjZPOr7w5J295hkoZ+M1x0L5NTA/Io1n/r0/pZ NXLV3F/EFFyXUhPIn7ej+BvJJGKMy7xXAE4Cd/kzRmsJsdByAdsD7845tOePY9l9UP 3zF5pCsodZn2cyAlOrnZqFHZwFElGUmsxrHlcvOY= 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 6.12 359/555] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:06:42 +0900 Message-ID: <20261204100623.552593391@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: 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.12-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 @@ -659,6 +659,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;