Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2890396pxb; Tue, 24 Aug 2021 09:58:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlxImBW5AJ/niBWn4UQgAyDY/pkfzwYpTpSG8wWY0j/vC9yJhETsXQBNry6tHyw8EI/Y9t X-Received: by 2002:a17:907:2083:: with SMTP id pv3mr13464932ejb.402.1629824303724; Tue, 24 Aug 2021 09:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824303; cv=none; d=google.com; s=arc-20160816; b=puOPMLhYV1AyGy6l965Dd93NPiU/pAio0LL/Z8bb69pUr/Q58H4vyWA21SyIRbPaxe IZ1JrY7zZ3G3aX4yBfxw7972/cADsFJ7Okrkd/qioq5koSUcfYboWZxJN/Wl3lOtyK+c 3KOBjSnekUWs9ohnted6ZXUBS50HbbO+WGk6l/+FzZ1RTbegqV/Cl/L8K2yWHR048wS4 ls7Hbl2iLlugTCfeiWrvZ0qjr8jRjx5OpBpiEZ6T45GGz+2iwcE6ZI1RCDl9Qx/dCE4S wX6ROH2bKlq8vYP9+y9+91Ao4aLE2s2yblmYAkbWEKcuRLv+VRp8l8IAz98cr3mhDaIK fXdA== 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=icAH275sjwvkSwGi86tJLmtGE/e6PmBjMHy2k1fszYQALYC/KsLfueF1pI/i1jWDP1 PFSasgmyFKHK68wVC34jFvX3RtK43+zxm5D6P5C4pLw53TmIEsNXgqNVCovjl6m4+otV PCtzmVUOUDMSZrk/YlWGKV1KYnUqfkQBm4h43OCD6Tbyzg5g1EGeyQSJWiRXt9waTdOL 2ARCMoKuin8mXK6O3nGQK34wgO+1R2AemOOgu5FzA2jNhWC1oUQsfx/DhrVyA3TB8fDi m9MoyfyOLhWddlQfZSlXJ1v/sjgbjEznzVlYW/FcUCPFE8HyEhX8JB0eIAczm0eRdI+2 6Onw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PmpjUb9A; 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 h14si5458639eje.454.2021.08.24.09.57.58; Tue, 24 Aug 2021 09:58:23 -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=PmpjUb9A; 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 S231201AbhHXQ5K (ORCPT + 99 others); Tue, 24 Aug 2021 12:57:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:38780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233631AbhHXQ5A (ORCPT ); Tue, 24 Aug 2021 12:57:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E68E96138B; Tue, 24 Aug 2021 16:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824175; bh=iWvU1n7Xu0JlgJ0bdwl8Mf+K9kye/OKxXwSbIDFd6S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmpjUb9A02zwJ2kHmmJPu/0YlEm6+jQj5dMKgkVQPt4vUGueY8tMbGCYh4nsM+R+r GlKLo3jAdfQSdvBUWB/uH+XZTOnX0H1bJnvf6ZAIgd0fMRMTUCA7a6JzGEsXuDwxXC mBT2gasClerwY2N6xMvUe9Jlxta9LZWh0RUhREARwVYSRTcIzvulk0V3cZq+ZaKS0L bTha0e8MTYeCKUWKvw0FwLXaQCgFy2Zu92nixJ63FeDFhKkSXwE7T1Tm7+fjYPU0yQ lIoEWeZ+jT3rkeBUGCYPFWXdl0DccNNbFmguhMTtdxxwc4INJ+JNxeG3ajGMFHPbPx tBorUr/Pton/w== 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.13 006/127] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 12:54:06 -0400 Message-Id: <20210824165607.709387-7-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+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