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=1796380941; b=tLsVdfaPeqL1beVj4GYyajIPVAJfNPXcQvpNvoC4XcpCcWAbGTVa4xB+gKNWItMg+9Kv GaV9MjJINhTnBbyDA9GCf/gA98nMOKsNxhAslcYlk7RyIFFP9hTtZgAv6wtoyyrsly7KG mZ8z6jPFTHHpw8mRqsWfQ0SmHOBN6CW27yAQoTGY1beWwecwRtqwm73TDZ0wXsS0EEdMZ F6zo7PeYlyOzLFqGDlS6PVUGkrbLivC78QXUlifdbbWPN63XlRxsuoPAMMvEz47ISh5Pd ik3SR9QbuAGMIj1/IM8wdmsBwu0iBQB/at0Zau04WbNiqI5IVLQ4vENXj+ryKB1sS1w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380941; 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=dKBDflcZk3d8J6YRMNAdzTYqzFWdM6J08hHfqy6f3/g=; b=eegxucvk27aDkmb7JIfi1RLtqnUB8fMjihFGFnrPZv7+saQQIuRL7WKi9C++rBsHmM+x 8yLeHh/GqILinmwkGfil2e5vQ/sOfMCLTC3bLR5jKX2ZwVlrYNHHpbUt5eSEht9+aKVTK GEbMYbcQzruPhYdMMAwGhpSakbZroSGMB8MoFTtGiq2yl9kuw51xSWVZkEz36X4ltCb1w B/ZCnWk0cSwHhRU+uh7mlSgbvwY30LaSBZT1RiaMTSnSHdhu+NBtPft8k5rA3rAutdIY9 WaBfTpDWiAihwhba9V5gUm4fkThpxK8el6yL/11MaWd/oEzTRze+ffbu2W6crNxJD5w== 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=JF6VhGrx; 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 0AA39606A322; Fri, 4 Dec 2026 10:42:21 +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=JF6VhGrx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 724561F000C2; Fri, 4 Dec 2026 10:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380940; bh=dKBDflcZk3d8J6YRMNAdzTYqzFWdM6J08hHfqy6f3/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JF6VhGrxHkIfywF/gSHw+4jFd0eYgvDQ22uV4mDNWWYxDfDP5LdP1uQSZ4itwzss3 XvuFhtKjyiv6iNOBZmanDdoBHmlKEULELxUEz7N9/VgblVHW/ogFiiySA9Llc7DNoL mPwnI9GYfeGq5tJ+FNeewsUDIbO1//NzV5lTv8fY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Julius Bairaktaris , Mark Brown Subject: [PATCH 7.3 439/742] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:05:03 +0900 Message-ID: <20261204100646.776268862@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 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 @@ -900,6 +900,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;