Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2905627pxb; Tue, 24 Aug 2021 10:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYJJuZmHN3In/a232BCmyiTGx8bfzGRhblBBII6Zp3Qb/7pm/AjLLtrsPZehefngNOJ3hj X-Received: by 2002:a5d:8e19:: with SMTP id e25mr32618883iod.175.1629825459567; Tue, 24 Aug 2021 10:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825459; cv=none; d=google.com; s=arc-20160816; b=goMt56hFQ1PsMkY6NQbz1Vas4So5e/SvS1lehddgg9VIP+2fhHJh/vLPP4B3qg8KZx 9kfJCJQLi/dimNW4/KUe1CIxEmROFAGBWJVesB797kFUVBCWRNRHd09UZsen45Tpyfp3 VrQL5ZS0wxWzSldCNQM7m8Xgb4OujWsZY58wYisuPWVtgmbUri7iL02VJ8S59dLuCxNr qKwZ9KBjwawzx1/JkCfp3BszXqo4a32BA3i9EIBxZBmb+fR1/ui9miB3HHNymK8GsmW7 4Mdj7JzCVZVykr8Ep2YNKN5d92R/g9qH5yzH9eAQnUn2GQz8L7/Cc16pTEcEayzbbbRe 9SXg== 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=RXZCtJ8qtt89UiNA2B8lZ5adz8iSclkPnEe3pKIw7pEtb7/Yy+Xr/SkJth+lCCDnqj zLq3IkHppZDqFhkOYJA9dUI+61w7qLxaEgRMnHJtLNULJ80b3TPy4jof8ilDKOH6QAUP w8fUM7mpmksX5JXJjx/di9tflybbmm/IeCUrIa/HfZywfFCmR7LSohHevM+MXmO6808W OwIxf1JtNbMapBKpIABQaJJmq0upPVf8T1oEIEL+J2DnbI4Uor0aNGmCvrVvbQBr/Ul/ tEjv7g+eAudssaTmMU0cSO8ERX5sAYeF9AfxAbx6sYtkyxunIlvZXP4P9Rn6PaUdNFPG DdcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ii6GFZnf; 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 t13si22274820jaj.38.2021.08.24.10.17.22; Tue, 24 Aug 2021 10:17:39 -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=ii6GFZnf; 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 S239338AbhHXRQT (ORCPT + 99 others); Tue, 24 Aug 2021 13:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235077AbhHXRMj (ORCPT ); Tue, 24 Aug 2021 13:12:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAB5861183; Tue, 24 Aug 2021 17:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824482; bh=iWvU1n7Xu0JlgJ0bdwl8Mf+K9kye/OKxXwSbIDFd6S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ii6GFZnfX26OH+22eslJDne3CKkuBVop00SWEjwKzkO4Ij4wRQbJYpISOdg8Segr5 AbN4tPrXbLzW6cg5/sFPwZ7gTujRhg1tXw+guPA5Jegunz3Bupb4FkWCJtygQNcOQi L8ThiPS0uZ0CgB7M3xFVPASjdJMrUvCa3f3KFLRxdn/RYp7DEnfzK2bPcp+D4CCLla H9m0NAqi1fji+mQ3LS9/Ts5MGl3YF1DnM047r189ijzIaF/YTCp4Ard/g69H3R+Zd2 oBZ/ulqXUsIrWFVXxkzpYudlXG6SO9Gyy6NYDfDr9KxShjsU1KkdA1IBvlP6MHnG5n MZte4TqLXEFhA== 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.4 14/61] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 13:00:19 -0400 Message-Id: <20210824170106.710221-15-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170106.710221-1-sashal@kernel.org> References: <20210824170106.710221-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.143-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.143-rc1 X-KernelTest-Deadline: 2021-08-26T17:01+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