Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2923948pxb; Tue, 24 Aug 2021 10:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTiGHUkShS5hZVLBAMDpQJkG700DEzj8YWWOH8VVau6vpv8u6HpUzMVnGliDVq+mAdO8As X-Received: by 2002:a6b:b586:: with SMTP id e128mr32384993iof.37.1629826960639; Tue, 24 Aug 2021 10:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826960; cv=none; d=google.com; s=arc-20160816; b=AZ2uW0aazRuCDoqCTeNSAo/Cn+m7tpjOYbAPe/IO25t5dcOlWh15EyoXl0M5CBC7o9 W4nbLnvGm97Wv9469VLAqRVEDz5M/YOvJ8XKSOqzORmQSHbnHUZ6nuy0XufR61deHzTq j7QsXv8+okZm67MXZdLqHGXq7erhb3wHOO5dqJVk3kTsjrkQjpeG1kRvAaW1EiyWCKwB hc/hHkEJQRgWYKIrOcN53FQ+Xt6I5Nmzr0O/SGlGrsv8iqf3Pn4+U5Mst7Jc8uU01jJ6 CqWtrwxyoYBiioR7tDM/hfA4BxfG8dN7vs+Xrq+CS4CcVcnhoL/npR4VnM7kmoAYTZ0U BV+w== 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=Sf9UeeUtg4NP5bsyHVoXJ4SSpkfsKYSiqBPcENMA5g0=; b=dZUADgrER68L5Ssak2un8Nb/kuKqG1xhbYrLJZSiugZYUqazMGF9mdZLvCX+CmfnKj +WJMBqDxd6hlLn+OJLvhPgrBqXrHRPM9RQQdsPEkM03AciD+WNCQ26rFWwq8b9q86+UI +d3TC9Gjpt/sULON18kLOV2m7TnCCdC2T+D14v7xzYZyQbgGdg4jcHyTaJPyte90Jb3j 9cD/LA9PLXISp5HTmQTKn/b+8/rEiIMvXbwyk0VpeNPrGhOTRIzDfxbMobyo0dgtt9iG O5vvcf+57e8HIzAKe35tdJSJ3RFMZU/LHXbPlo52sHGSTrSouuptArv93O1Om/NTAAIc fHjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KweS5wP7; 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 i9si18565176ilv.82.2021.08.24.10.42.29; Tue, 24 Aug 2021 10:42:40 -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=KweS5wP7; 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 S242057AbhHXRl3 (ORCPT + 99 others); Tue, 24 Aug 2021 13:41:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:44794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241938AbhHXRiS (ORCPT ); Tue, 24 Aug 2021 13:38:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7AE2F61BB1; Tue, 24 Aug 2021 17:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824880; bh=bXXPPSl3UEzk1Aov3GYXRmLxrCKsx+1rwjgrEp9BZgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KweS5wP7cfDC2pzDw0O4dHf1Q22LZz7XKWGnFCjf/872+VuV05WUNP+o7L/m7h+iG K9Rn6XTV+kZAwBFraq3wrb/GVK/Szbr/cYCIr8AoEnCxNL75Lp9umr+zx120WSpilG nJilme8Q3aY5kZY3YbavfkT1HrdNjEjsLYMWuzbT87pDesxc6LjsDFll7iKphCGg+U Ajw84sQGxNo48r/DcNBS/pskyOoMYzjiZp0Ly4AIYyMKwl7hbe7p7fllVywzXsjAgz rJwogV+qkgfcoQdLpTfdoa48KdToHlxAgjNMYMtr407CbeWkZEL/J8UfsN+CoxlpFi 7HBorG2lk874Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yu Kuai , Hulk Robot , Vinod Koul , Sasha Levin Subject: [PATCH 4.4 16/31] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 13:07:28 -0400 Message-Id: <20210824170743.710957-17-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170743.710957-1-sashal@kernel.org> References: <20210824170743.710957-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.282-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.282-rc1 X-KernelTest-Deadline: 2021-08-26T17:07+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 cc8fc601ed47..416057d9f0b6 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -863,8 +863,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