Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2899664pxb; Tue, 24 Aug 2021 10:09:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGWgXjsIjZU91RqIjshBtz0RJaAxZcrkBXCNdmoNFYDDjn0NA8SAJkXyKUJHPPnYnKh5mk X-Received: by 2002:a05:6e02:1d08:: with SMTP id i8mr28279257ila.185.1629824993470; Tue, 24 Aug 2021 10:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824993; cv=none; d=google.com; s=arc-20160816; b=zxCaAiO4o4xpSlWNFujRE841yBneRLgsovoSt3NNyUisfUjTxLBdysaMtcUSaPUInc fH8NyOaPHS+kE/YbN9Yio/L+TpQuu1ZUjWbSGa3fC05Opi0jaI+7MpSNfNUNVUZ9Sbl0 oqHf3BRX4Dp9aZ7LGvecui20bLoptVMX41y8dnkcmNEROUUUMJCCxsdNqhimxptg7KGw 2I8NQ9EH6RALbYfOrvlI5+iOEoI7FbBU+sjsIxjthKvtUpb+H1zdN55efinY1TMfxujU m5epT9xogDe9PZwKvnST7N006j0FmTvYFOR2jZC+LR8V87gnOdjTXoxdOJt+mDdBAUnK 2QPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uYBDBXsb/fqzPYnM4xqJkeqYUfG0oIJdxIVNrlAno8k=; b=EhSLJJJapbrqSM5rvqw+9ZFakVxeYwyEWW2Zs2vf0CD9I6Jq2XmvbxTX0uZn1jR5Cm HnlZcUFsKpMAcaYv6emrPRDcgbxp00A31y8wqGsXIYUkleKxPCLgOy7AfdLRYutoP+3k XUT+eJBiP26y+kvGbQ5z5xYkn4l8HoRq3oAnPJ0C+qdBVFHHiDPVnJDEoxcWdFasbLVM 4AnU+WDjiHt9+OSZ/OzpM0yhMbEqs9SXwWZBcCNXazKB8rDf0UJZEirSY5KvjOwwGsWk 8RFexgd+60wecRmMlJGrka+G4HDOcJIDRwLnFUYcPe3CC1N7Ml9DBWYNb3cK2G6z0SsL Ahsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YstNqppj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si15937319ioj.101.2021.08.24.10.09.38; Tue, 24 Aug 2021 10:09:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YstNqppj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239563AbhHXRHU (ORCPT + 99 others); Tue, 24 Aug 2021 13:07:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:45866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239582AbhHXRE2 (ORCPT ); Tue, 24 Aug 2021 13:04:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B55B61439; Tue, 24 Aug 2021 16:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824367; bh=iWvU1n7Xu0JlgJ0bdwl8Mf+K9kye/OKxXwSbIDFd6S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YstNqppjk2kYIRQV0Qwz4Zi578y/HgU5p75mZjnU5bA+QtkV3uDdrhPGxPv99bV9q Hi5faxC72NRc2PzDnnTz24bVlyhdGsnlXhS6tF3r6bOXOVX6OelXpPFV//c3LrydAj lh0yK96kZry7ExR4kmdPk+XrEvibffXg8tQeSwtN1zJbgxRR32gMD2hXuX2wOs09/s rOmOvRon5GWChDQc/U8thuyH4/OsJNp3C8M/x4ni8eEF4N+d4zVyWZl4vgfwv+f3QL 9CsV5s7+47XPQ5H2eZTAfX3gfk1yrRny98HqX7ejlayV9qt3sS98ggXRYUHy8VDPVT WoIHqn6VVV1MQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yu Kuai , Hulk Robot , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 17/98] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 12:57:47 -0400 Message-Id: <20210824165908.709932-18-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+00:00 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 1da569fa7ec8cb0591c74aa3050d4ea1397778b4 ] 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 moving the error_pm label above the pm_runtime_put() in the error path. Reported-by: Hulk Robot Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20210706124521.1371901-1-yukuai3@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/sh/usb-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c index 8f7ceb698226..1cc06900153e 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -855,8 +855,8 @@ static int usb_dmac_probe(struct platform_device *pdev) error: of_dma_controller_free(pdev->dev.of_node); - pm_runtime_put(&pdev->dev); error_pm: + pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); return ret; } -- 2.30.2