Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2917336pxb; Tue, 24 Aug 2021 10:32:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2mjJwhDQKj4FFfyliHZRTj4kOoxJuSQuag0Gme5SP1U3jskTUZxupgZ7wYQfDHjX6uoQx X-Received: by 2002:a02:7a15:: with SMTP id a21mr31794203jac.128.1629826376394; Tue, 24 Aug 2021 10:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826376; cv=none; d=google.com; s=arc-20160816; b=v/4Kxh8ULynaKGfnuNliCodkE3Q9F813yF1eUwUxMMWoqQKiLcBJ7QiFB+RtqUK6LQ IGoLyZpw9PaOvfRqPOv0moABVvsbPE3b5jWD/rqHIC2cwltXUke+1ymziUBoRWwmYn5f E/2TMCiIvSY4Zq2i0xu1P5DeIgWEG0iGQAyM3ZR15Q3+nww5eO3PGnAzZNf4ztVireGP 9OnSIhG/XDKYF+v3cUM5sdtTDXIdl7ovUTU9pqSg3f7Q1cdO2atDcNSoB8+wZoM++K5I 5KeHqtH7kOXLztm3tc/4WTcfJw4PJ+lDo+3zOZcCveUIGbxWsy/0x6aF4QFFW1ZnCmWo fpfQ== 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=YzlWJAeOyPg5WSjD4Yc8+2IHKCLC8a6BM6VEnX4l934=; b=YxbIW4iy75Rr4R9fNdelCfLnp+zwBaH5xD7Tkdri771Jn5+f9AabmoFZBTGYADeVog JVk+wtHR4Y9Z86NCUdS+V701pR2c8mdR1sDENwQtMMsNgu7acbtjDDogvySqP4ninLnO NKZRPkyjO7n26jpXhjrC/8LBHFbLvhjEv5sTFa+F6BpauXjRW326xhmUsFffankELLVl SBkRZdXqAHMA2+GZZPFhv/6/V00dQrB5Mz3RnaHiaBEAoHArQaibDTW65fA87cNSbAPd 5C6A4PJc/A98G13X8yrvWBd4SJd2eYjLa42KDFViWyGTx3VabpgGCEBnC0xyNENTKLPw pZKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jC83wm6C; 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 u2si15368098ilk.59.2021.08.24.10.32.44; Tue, 24 Aug 2021 10:32:56 -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=jC83wm6C; 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 S239976AbhHXRcn (ORCPT + 99 others); Tue, 24 Aug 2021 13:32:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:35032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241767AbhHXR3w (ORCPT ); Tue, 24 Aug 2021 13:29:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 986026138B; Tue, 24 Aug 2021 17:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824736; bh=06702bpAaA2YITqoGY2oprCfqPNOskafyZbNdqoZNTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jC83wm6Cb1xehuA3TaUuZuUk0eThdksdJgacxaU27NLvch+9jYvY0VPEGFK52n9tQ aq1S+R7gCT8uhpRAD5ZCCRVUWEGGF2h2ZHCZ+RuQwzWcUsGH/8ilRNgN7FnEj5M78d wtJTOkUqhLEwKooBjjS20vgvt2O+UVqjStO8fi/TQuYTYMPB3M+ClcL9jsFkhbeJyM BtD5BWf+xSvW5lqa6vkvHbPxLP74qvARnBIezhbhezOm0vdxtsIeHpeVQba0bt7XCP 1v7pdpxXNFHJtufDj6kEBLl5uW81mivuxBoEhPP2x8m6mby2iCLrKwmWiKtIzUTLN3 Eh3pJUni7uASg== 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.14 39/64] dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() Date: Tue, 24 Aug 2021 13:04:32 -0400 Message-Id: <20210824170457.710623-40-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170457.710623-1-sashal@kernel.org> References: <20210824170457.710623-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.245-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.245-rc1 X-KernelTest-Deadline: 2021-08-26T17:04+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 31a145154e9f..744fab9da918 100644 --- a/drivers/dma/sh/usb-dmac.c +++ b/drivers/dma/sh/usb-dmac.c @@ -858,8 +858,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