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=1796384825; b=D8NdUfe5P2gI3h+hwlwfH5Cr2BkdBGELOoRkfMDPaarP2jdIIf5vLe9S1nLLfDIomV4V /4f5YegRh0oe9RF3PzV1/IpEhuu1APgrAUBZJ/6AksByWjbAT9rOe3dVQtSCn88yRIv++ +iGPXHLfusCDy/aImOKbHVoiTd5rCMaAikD2/QLgyg+0FvgLhgtvwo8z7ATak2WXRDINF PXVHe/QOurndUCBuSxEgwobivf1zQLiOZN3+oNH+syxiFGTHo8MzATKrWJa8vKUtHNF3S U3Vs91FimVS8dfKxGeMH1BAA1VuOGU5QAmh1+4Dj2m25nuPY/SCkiPZddrt/QT07mWw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384825; 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=QbapRI/9aNo+kCxP91YVY0ZryNiEInFyvEyULWOTF+w=; b=LkKpdspbkgnSq1wpGk/fbmeewkHx7zBKQNuRZrlG8tr2uIErP9RmQnlWC/VsiVXkTrTS KN1yd1+OYTF11fo4DEMEo27tEdvnS1DroUxCzxqxoigrUuA+HGo3zZ3BV62OSg9xOOy8Q 5w2m95L7nIocX4WI3hDO9FsG6hiruCWsTQmSOgbXOOzIn5BA17pCDsSFWEVdwGegeuVEj LfT6hL09VSZ3KD2LeNwA1ZA9iU/47ocmCeqLWiDIkkt4aMU2yvEr5zMJaG6MAuYKR9k4F QtzmSYwi99HJZhl5+fXgHEZyY/k7qjQlDGWEFRD6iKIULbCQm3iquv/9g0yMXVD/wRw== 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=c6pkgwG+; 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 A5680606A32C; Fri, 4 Dec 2026 11:47:05 +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=c6pkgwG+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 235B61F00897; Fri, 4 Dec 2026 11:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384825; bh=QbapRI/9aNo+kCxP91YVY0ZryNiEInFyvEyULWOTF+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=c6pkgwG+xTweKbrakff24hIoQHLucTqOHc25ygk4mkJZdkmRTNiR4mDU0ZhRO256B DA/3orTIm271WUBaoAmcxwBZlPBZZRgXyUSFpIEJC4C1O+1WfbNtuBlxa8j8Ogg5uN Ll8Wk27jC38OaV57vTCF0MwjgoG7EUHgFoUyrKSw= 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.6 0309/1167] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Date: Fri, 4 Dec 2026 18:55:36 +0900 Message-ID: <20261204100710.069998076@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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: kept the branch's existing kcalloc() allocation instead of the newer kzalloc_objs() helper in the context, then applied the err_pm rollback on top. ] 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 400b086f7295a..fb2abc02803ea 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -484,8 +484,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; @@ -517,6 +519,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