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=1796382311; b=EKTUie+OyNGmdMsshdIC+kJfLsznkvdf8GnvePKhEzlUIpMjAVS41IYZDiDhGYcIaKsI oHPkXHQObolN5YH6Z8CIsi2t61JmW+DmB/ytB033VocE0zGSOwWzKT767Qy3C3rPPLTOe vQp7ArkmQT8Ob2p+EhupaDmVSW86grkfIT3CDIJOtZ6u98yJc2jDrt4CIQebiS7fPUyjY zwmloLF98Ndrek1h4vS4XOYgtO7oEHZTcoLddfyDG9wFHWNpH1SCrME7bVPscVKASOelb Gxt+mLmX32piH/GfCHEeydDuID1GztnfQ6Pt144HHv9sGft8tUou49CqixyuYmF/RKQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382311; 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=FkX9IwHE1Rw9ppAgzl+74CHO/bABmOLIxSHGrVLQZEQ=; b=j4k5Qztp2qM3vzgcUlpPUtwPcPjmqCq6h/sHhpaPL/KuS5pH3OC48/+YIAbC5urp8/kc iFymUYMwgRauXpywJEYXt615cFowTvZokjfxmsKfAzrpAAkLztZgHO5zcRziXIGABG4pY clfGvFbOuufphmtM7+XeI98tutK1Fb0Sk813N/CopDo9u2Rvo0sXFmKlnKeXIB4B+nEe7 tI6HpvXRDYdDnUatlSOe42txBI6jbc9yr3z0382rplDfm4MyrCZ3aVcb3HEi4Z8EGlXco eOf8UpFm+Xw7ZDFNRGe+3GDGJc5H5LiYal2SKAdAY1T9uxG3vgTJLJhVH+3lMWb4NVw== 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=xx3xm0XM; 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 973C9606A322; Fri, 4 Dec 2026 11:05:11 +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=xx3xm0XM Received: by smtp.kernel.org (Postfix) with ESMTPSA id B60DE1F00931; Fri, 4 Dec 2026 11:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382311; bh=FkX9IwHE1Rw9ppAgzl+74CHO/bABmOLIxSHGrVLQZEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xx3xm0XMxoaMxRoG55D19VLFnfVMpaxiAHwbLqPsP+SJWsWzByZW7ERhWS3lBKrg0 m4S00ER0vx8XnRfOaEmBLsQLTfIaLsiUI2zI2zo9oF+R4ZtRygiLP6aOMM4AuPfpxR ap/mT8sy/9qBirGHidNvUNKVYKk/ULJqOrdK3yR4= 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.18 398/703] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Date: Fri, 4 Dec 2026 19:04:57 +0900 Message-ID: <20261204100638.415985753@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: 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.18-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 @@ -663,6 +663,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;