Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2922107pxb; Tue, 24 Aug 2021 10:39:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKUG38tsAilykDisJwhVmQOrMk4JpHXJ+q4PiiDHA2gdYINO4N3z7Se/GEYv2HeL+S8dRR X-Received: by 2002:a92:6f0a:: with SMTP id k10mr26617494ilc.105.1629826794303; Tue, 24 Aug 2021 10:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826794; cv=none; d=google.com; s=arc-20160816; b=pPqtl1mdPtacX8c1dO11ivnkdXrnudlS3ChGWGzNh2HtERo5uQ39fet71qKWhdq2FE qsSbzQZT6GkFzwOXr0vTUaIdKehTU954kcEBndAXkj5fkmbSjKyStreZbepKeBUcOU5A vvnmGZor+6EggKGzG+n8gKQOJa1lAVEWTHsIZlkgsoh9qRLY7mhhj1aBk5iDB5dVdRb4 ajFumtdXkLj73OvC7rsN/LpOvgbbb81aSlWTyiXoOs5taAjZyEhPfBuBLXjQpsVw/Uv6 x5ykhzw56+qiQiyridrz+wr0ukWTPRDwEqNS2r7SmEdv5TAGZR07FpzfIFDc7InFTKYI o8rA== 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=1NexXgbNKI8L7xLE2GRfvC4NUAoy4BBiTWhAGk683Fc=; b=ug9OueYYbyVz/VsoghlAK6APmxiwLDnIhboxHrfYEA79yyvTgPcRQ3DJt8QKFwtyCT cPSFynCNVg22wzrBkN+rg4OtPbm9XCL7jWWKP8yN5GA+QZ4GMrZwKlBIHjVmOQPDwP/0 57Ou95jVHjaemjNhqxOv6IWiul6w/3aOfzCv2ZGhRRJHIHdRkGt0StHmWOrm8RKNMZOq brVIF680ASHHZ5O2N5GUVrsL9LzfPkkB/GRn3SoPV2l03ti8fANf4C/yG2YX8yChU5N6 RYCJgZoivOEbcusNotiDoi9P9ZxN+iSZ3FMVKJor1GmZMObbXp4lR+yC2pP3LVlrMrMh 7ULw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iGDq62YF; 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 c203si21923120iof.54.2021.08.24.10.39.42; Tue, 24 Aug 2021 10:39:54 -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=iGDq62YF; 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 S241618AbhHXRiB (ORCPT + 99 others); Tue, 24 Aug 2021 13:38:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242098AbhHXReg (ORCPT ); Tue, 24 Aug 2021 13:34:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B15361BA0; Tue, 24 Aug 2021 17:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824799; bh=GJQUHHC19H3AosXMyk0tjcmBoizngaJClrlOplJcQn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGDq62YFWikylmZjOH4hf0XPcRuxVMiXG9CD4O22Inyv1GUR76mdzyO8OsvpsCLHW CH8x8PazeFlkq1xOEZJZ6KWI97o01cm3MyMnL1+ENlGtsQMLh082RbuDQS+qDVq/Eh CkaIaxMJS21qnbrI02vI+EEmNpyOfTXeGVK0Zhr3C/9Hozk73vu7VPsNmFFnEL0XTw 3a2YSF8L2Pb6PsLXEaGCKmLc+iFnH/4bid11nGkFX/8mNyuq75piaOP+u86i+/aPeq sxfeG7zAWUd8tK8Lhrea50duaVYhRLJ6E8Y9G8TXOPDXMJnyKnxuK8BR3zC2Ai672N Nx5regu0TpusQ== 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.9 23/43] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 13:05:54 -0400 Message-Id: <20210824170614.710813-24-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170614.710813-1-sashal@kernel.org> References: <20210824170614.710813-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.281-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.9.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.9.281-rc1 X-KernelTest-Deadline: 2021-08-26T17:06+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 6682b3eec2b6..ec15ded640f6 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -861,8 +861,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