From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0259C48BC2 for ; Mon, 21 Jun 2021 17:52:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C89256115B for ; Mon, 21 Jun 2021 17:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbhFURyO (ORCPT ); Mon, 21 Jun 2021 13:54:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:38198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbhFURyN (ORCPT ); Mon, 21 Jun 2021 13:54:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 55EF3611BD; Mon, 21 Jun 2021 17:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624297919; bh=32WYo5ihIgTpcTEKbKB73QoebLnYJZOaD0OgAOWFUOY=; h=From:To:Cc:Subject:Date:From; b=YC2FMyuNGNmOX60vU/Te6yM4NdIfL+l9FnxY7Bu/C1j219xylIt6+n1A0I/SzecJg IbtVZ3ZuHEPIY2u/ll7qSrNfO+dpovcm5sIFMt6yWy5VdixJqA0bZ2jwirYTax8scm IVLOrgfSv9aMCq2xMk2BlHBtYfudjiiylWqblSLhM4Lk5BEA0R/YoAavVx45MdOzkI vyzc5101ydtfbzyLJ+QnXSeV3WtcJz/T5QwguGbnXK8MZ4pv8KAN9ec5Z8Lruioyh/ 93zhEIlMiKVO5TC6yVrl8WfxzDZpiqQcBq7t0LGpSEaQTxWurI/B19DNyEK7AvaGHh 88amPxEfKNVFA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yu Kuai , Hulk Robot , Vinod Koul , Sasha Levin , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.12 01/39] dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc() Date: Mon, 21 Jun 2021 13:51:17 -0400 Message-Id: <20210621175156.735062-1-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Kuai [ Upstream commit 8982d48af36d2562c0f904736b0fc80efc9f2532 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Reported-by: Hulk Robot Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20210517081826.1564698-4-yukuai3@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/zynqmp_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index d8419565b92c..5fecf5aa6e85 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -468,7 +468,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) struct zynqmp_dma_desc_sw *desc; int i, ret; - ret = pm_runtime_get_sync(chan->dev); + ret = pm_runtime_resume_and_get(chan->dev); if (ret < 0) return ret; -- 2.30.2