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=1796387479; b=nJKOq7Pbn/B0mouQHJO+te2AEjGRJFV7YF99Sh5IvMk7fLVIBMvRWi6/VC7GWEeoD204 AjXj0QqqgXP4AZzXn6I9DtUsMDXHTuk/meDrIU4FoyYy/nxXSFpjOjcBowSM8e5astDrS rTX83m2Xotz7wUhXFARxPU0RzWWu7xYBYRK5GicImAj5opEbziOeDu9j/cddS3fmR73mN PNlVCRs121G716saexgrZk5xC3IT70851VWI3+H5aLSGZqCjP+Fm+BRF8VC2LlvNNRVxL Z0h8J0Y6ANjZf9GLYYExbsGQHfX2606rLIrZaYtKz6z3SgvPeRyC++KXgVKazrjA8iA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387479; 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=2GJIMxQ2rwUBxi5X8f1v9qRz9vBwS8OF4+Wz5ElripM=; b=Fk/klMuGhd0OIOnTUKmqHlP9FoOxeTteX7tId3//vl+RlWuiJa+ujHXJ5mrw9Z3nyRNq ylMutfbe8ay+zKQoKZamZzU3yINAsVpvK8C6vAKUQWtBL0WORJDK5Y7q7kCDd4r1Gqc09 RM/Mv2PCV9Pyr/idUxUhvPQEMtz7FrNi/7Q1DY2Lpbi7wNssRLwsUGzmUwBkU+2xAVZyA o2nuDEiAkK7MU5pp8JJCOlHc14IHMliGTPeVgWJ5AhJklPeegHPx4ejRLmiUAjpCEwqpF gpapSHYK6kFiDl4Hn2vz6KJAI8A4Kbh37A9JwH5vTGeke8fRDE2p4dsGWQu09w2KBdw== 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=spvnqVBA; 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 30E80606A334; Fri, 4 Dec 2026 12:31:19 +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=spvnqVBA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBC21F000CE; Fri, 4 Dec 2026 12:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387479; bh=2GJIMxQ2rwUBxi5X8f1v9qRz9vBwS8OF4+Wz5ElripM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=spvnqVBAko0Syo6yRvqS8IyjQ7f3X2ol9QPzKPCIC5ZKaG0DErK6PTRPEwEsfcJbS XZhqkTkUjnLLaERBGkFxQHeC+15YFsDSADIiR9KIh3sgBgx9HufZi0CUJ0GhYUP+vk ktkBKKJ7NToXwyuyuC1RKzwhn2iv/iTMayyl5TZA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Golla Nagendra , Frank Li , Vinod Koul , Sasha Levin Subject: [PATCH 6.1 0260/1059] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Date: Fri, 4 Dec 2026 18:56:31 +0900 Message-ID: <20261204100651.006352446@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: Golla Nagendra [ Upstream commit f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e ] If sw_desc_pool allocation fails after pm_runtime_resume_and_get() succeeds in zynqmp_dma_alloc_chan_resources(), the error path returns without dropping the runtime PM reference. Route that failure path through err_pm so the runtime PM reference is balanced before returning the error. Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()") Signed-off-by: Golla Nagendra Reviewed-by: Frank Li Link: https://patch.msgid.link/20260814045616.1661199-2-nagendra.golla@amd.com Signed-off-by: Vinod Koul [ sashal: Adapted the hunk context because this tree uses kcalloc() for the sw_desc_pool allocation instead of kzalloc_objs(), leaving that call unchanged. ] Signed-off-by: Sasha Levin --- drivers/dma/xilinx/zynqmp_dma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index b10f626ca2c99..217f33f12aa82 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -483,8 +483,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) chan->sw_desc_pool = kcalloc(ZYNQMP_DMA_NUM_DESCS, sizeof(*desc), GFP_KERNEL); - if (!chan->sw_desc_pool) - return -ENOMEM; + if (!chan->sw_desc_pool) { + ret = -ENOMEM; + goto err_pm; + } chan->idle = true; chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS; @@ -516,6 +518,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) } return ZYNQMP_DMA_NUM_DESCS; + +err_pm: + pm_runtime_put_autosuspend(chan->dev); + return ret; } /** -- 2.53.0