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=1796387686; b=TajamPYqOGcR5aZVUOzw/uwTTD4fUw+2RwLr5HYdQI3cPukqq4NYDDJ1UzwGV8hRPxBU mWYRUwanUWY6IhUMPN2k5BZNTOh1GCpPtcotaOafmqWbVr0R+U5dnXbzncMLtFQyCo/PT skSnHZAnyf5u5EpMWhHYGsAi4x6PcDUCwfnfgB29hO6GOx0xc3eTqNB3M5X716qUxlHzi kMkBe/F9O6CT7lEmRzDR9rLgYCGlrUIrFtnbrDFDdh7M1RdugYzuHhC60jKXPg/6zGe9T KjTJbZAIgpw6WimZo4rDz9GamxE7YehAvONzcvI5UtxLgLTJFH1HK+O8FmtdzBdMF/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387686; 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=hOCx523VSQvCDSENAXnH1YKQzWgZ7rG21zyqXcgxdY0=; b=iy8uHXw0RIbN7jnCovdAT2SdehjdPmLzh8p6TT2xNk1xDvNWeYOB4BpqwNuHR4UhuhMa sWNtIeTdmVow77eXHAYKSnUgrvpKRY7H+72//dKn/g4GnAt+E7tJmm0Tj5dw/GBkPXKl4 +ELiH+3TdZmTo5Yu2VZuQszxwxK2jxgkwDb3eNXuFGcP4t2vGPNsFim40ZIkeExyoL04c KxbEfgxlseOQ6wLTvM0axD42/F76KPNCXG57W58PB1ocS7zjBfwjzCvi5OyYzKNTvghMy r3m56qy/Ll62aGUF8EldBCwcHnVdPGdQG/eZ10qC3NdPx5bq9pHRvHSawzQa/qn1/MQ== 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=QAcS1lP0; 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 3FE7D606A322; Fri, 4 Dec 2026 12:34:46 +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=QAcS1lP0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A872B1F00897; Fri, 4 Dec 2026 12:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387686; bh=hOCx523VSQvCDSENAXnH1YKQzWgZ7rG21zyqXcgxdY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QAcS1lP0H/BayhX/DIzGbaqfMQSgbhyVcBvEAGvj59mrjM9qFfAMIzPZBw8TWGhrj dlw9M+YcctxYjLDNS+wHN0VtIloD8EqSwu1NdbEPG+R96TufvhZ4ZTliEGYs1Ignlt pkT2QjzRHw9LpBCoxE+Vlah9WejHn60oTSfE48oE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot@kernel.org, Frank Li , Linus Walleij , Vinod Koul , Sasha Levin Subject: [PATCH 6.1 0347/1059] dmaengine: ste_dma40: Validate fixed physical channel indexes Date: Fri, 4 Dec 2026 18:57:58 +0900 Message-ID: <20261204100653.253681678@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Walleij [ Upstream commit 884e01160bc727509b4fdf04e763a86b936df464 ] Fixed physical memcpy allocation uses dma_cfg.phy_channel directly as an index into phy_res when use_fixed_channel is set. d40_validate_conf() validates dev_type but not the fixed physical channel, allowing an invalid configuration to access memory outside the array. Validate the fixed physical channel centrally before accepting the channel configuration. Fixes: f000df8c5a0e ("dmaengine: ste_dma40: support fixed physical channel allocation") Reported-by: sashiko-bot@kernel.org Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/ Assisted-by: LLM Reviewed-by: Frank Li Signed-off-by: Linus Walleij Link: https://patch.msgid.link/20260927-dma40-fixes-v7-23-89f595e8851d@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ste_dma40.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 321e277cdf621..14d36b9dca5c5 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -1878,6 +1878,14 @@ static int d40_validate_conf(struct d40_chan *d40c, res = -EINVAL; } + if (conf->use_fixed_channel && + (conf->phy_channel < 0 || + conf->phy_channel >= d40c->base->num_phy_chans)) { + chan_err(d40c, "Invalid physical channel (%d)\n", + conf->phy_channel); + res = -EINVAL; + } + if (conf->dir == DMA_DEV_TO_DEV) { /* * DMAC HW supports it. Will be added to this driver, -- 2.53.0