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=1796381961; b=QeoR75vH2kvuOa10m2CKnN+Eqke4Ck+EGUKHIfGVObGvokwYmJd+1WdVoiNj52Cj8/Hk hz+koD+T0ri290X5yVXh6pRHAuQjaTXt2J0aszIcwg3iaAXFtCA461VXyJI2hKm+EKg4U G0xrEL39HpFExYKdgwZpSERSrES3Mbw+nQMpJHGIWTQlXGn+JKewlX3JO2jvmIbh0kDGT X2sBN9aj4th3jWV2KrOxWqBOiPpgZEHXWw3wzpwz3SSnb4x0uYf7BzoBPA5dc2bh+2Amy kD9ObuCbJW/5A65/EusN08TEBPj2a32ZtiL10wM4Q9RMjGxtQVt6ypwz4q+7byGhkGA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381961; 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=hJmWSb+VRfyt68I91AphfHPpfpk/RNw21hyIJ6etTpo=; b=FXdU2vKbMSt7N2c1WmFkfhc2fqxW7+UzIRFc+tw5h4QxQQJobUDobHbWCeMi2gZUhIH1 rnKwefjFUVV9PdrnArHrHPxnbneYOhoXWRwg0EXT/W2Af3ikqLHom4AXY+f+X2OWWvLNr VsNz4BdnBzMwGSfDbiE4XgYjNbUS7O3TklsYpUJXCZ53NLHGvqnNePyYP/lWraO0yTL+Y WZ+8bizTWoG6uDlhe/Ki1Jmze7X+I6q1O/RuGC6SoGCBzBbiO7hAq2jk1a2nuVjT4WLwr Y5QzrcF6bdTP9rJfxsRqBSZo9PY+p9SpKPnSWX1L3s7SBIQYbKKCp33G095iYuwPYVQ== 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=R+dERsd3; 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 B85BA606A322; Fri, 4 Dec 2026 10:59: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=R+dERsd3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33EDC1F000C2; Fri, 4 Dec 2026 10:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381961; bh=hJmWSb+VRfyt68I91AphfHPpfpk/RNw21hyIJ6etTpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R+dERsd3Htq4zqQmJOl1wL7TT/Z6cME6KKfubnqiCsXAFB/TAtNeCBdJ0B48Y+4uc 3IXHtrmn3BbXMESuevCbECbxnsuxWsIYxz8TEnTd0KONLccUmkawsByLzmPyjKPth3 D5b05dARgida7UFLQSgNoRz8XQNVHg4EsVPIo2pM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stefan Ghetu , Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 6.18 248/703] ASoC: fsl_asrc_m2m: allow only one task at a time per stream Date: Fri, 4 Dec 2026 19:02:27 +0900 Message-ID: <20261204100634.395596852@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: 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Ghetu [ Upstream commit f0277994dbd09cc45d600c2f86cbfde9c17c6fcf ] All tasks of a stream share one pair and one set of DMA channels, and get_caps() advertises a single fragment, but the compress core allows up to 64 tasks. A second task requests the pair again and overwrites the DMA channels. Freeing both tasks then releases the same channels twice and leaves a stale asrc->pair[] entry after close. Return -EBUSY from task_create() while a task exists, and clear the DMA channel pointers once they are released. Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function") Signed-off-by: Stefan Ghetu Reviewed-by: Shengjiu Wang Link: https://patch.msgid.link/20261116093751.138455-6-stefan.ghetu@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/fsl_asrc_m2m.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c index 181aefa9be8f2..d338859629e48 100644 --- a/sound/soc/fsl/fsl_asrc_m2m.c +++ b/sound/soc/fsl/fsl_asrc_m2m.c @@ -463,6 +463,10 @@ static int fsl_asrc_m2m_comp_task_create(struct snd_compr_stream *stream, struct device *dev = &asrc->pdev->dev; int ret; + /* All tasks share the pair and DMA channels: one task at a time */ + if (pair->dma_chan[IN]) + return -EBUSY; + exp_info_in.ops = &fsl_asrc_m2m_dma_buf_ops; exp_info_in.size = ASRC_M2M_BUFFER_SIZE; exp_info_in.flags = O_RDWR; @@ -517,6 +521,7 @@ static int fsl_asrc_m2m_comp_task_create(struct snd_compr_stream *stream, err_dma_channel_out: dma_release_channel(pair->dma_chan[IN]); + pair->dma_chan[IN] = NULL; err_dma_channel_in: if (asrc->m2m_unprepare) asrc->m2m_unprepare(pair); @@ -561,6 +566,8 @@ static int fsl_asrc_m2m_comp_task_free(struct snd_compr_stream *stream, dma_release_channel(pair->dma_chan[IN]); if (pair->dma_chan[OUT]) dma_release_channel(pair->dma_chan[OUT]); + pair->dma_chan[IN] = NULL; + pair->dma_chan[OUT] = NULL; return 0; } -- 2.53.0