Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9263740pxu; Mon, 28 Dec 2020 10:47:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOFASUbIdmU0Mxk33UP8umrbv7QAWFmhFYDbUGiCZCesQrDU0q9wv3T+AC05qHRCBcNJIv X-Received: by 2002:a05:6402:a53:: with SMTP id bt19mr44140795edb.104.1609181254124; Mon, 28 Dec 2020 10:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609181254; cv=none; d=google.com; s=arc-20160816; b=xpyE77rvdubYw81MwSJcBdr5W1yDNXls7z3/6ci8sL8e/WIqI1F8hoF53J0Y1Algg1 tdcfOFVOc+u1f8g0SIzENwYG/thx1xWuLc1JQJqB6CWBb1/YueZed/M4yRCy7ObEtSUX nXs/xY9LzvTgNXDZOJ79KJT4byW1sDtsuJq2fHrLbez/8bwASJrPRDiIIXaxOniTZHLA eHMTkfeMp9X8MMEOMj5INABXhzSTznuAxL50hQl4Xhf0M5MOCbXi0Wre+e2hO3RC+0Vu y1v4y0itdryLe+k21yp5E+siEIs/fIM8S3ZmCCInE5jOoXihU/DEAGtLbVa603BEXBnN AZOA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IarQjd0x6H45fEA3tbgKyaEYmJQJ6vwRZsisDiSKPng=; b=BuYmllaPUFOmNDOKDelD3ong4dLivzhyF1Q9dC3wAtS+6FuH5eAuWSG8ArffyCaQRl PN4kvTxiGvTiKvEFmqSaAbzorVNO/PHuH/Nm5HXolhtiSGRHFxLmXAkcTCMSCYGHPkRd TQR6UeB6goUs93uJSo1fJI1Y1LGArzzWX6F12aX8PIO0Ex1wWDqAsjxAWdYZ/M+p2Nyz OdfTGz+3ZQIjjFQaw8351/r8ZijYhSfrViGLezYZv73cAgZykKlXuy2EIDwHffQvGpj6 EPoX1iYNEUFb+Z7oYB2BXaQGzgKGDYVXRYb1Zlq+3iouOr5V2lGVWJnPuYYyHDvn5V3x fx6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zwc6vUrC; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si19972244edk.461.2020.12.28.10.47.11; Mon, 28 Dec 2020 10:47:34 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=Zwc6vUrC; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404242AbgL1Nmg (ORCPT + 99 others); Mon, 28 Dec 2020 08:42:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:42760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404216AbgL1Nm2 (ORCPT ); Mon, 28 Dec 2020 08:42:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4DD04208B3; Mon, 28 Dec 2020 13:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162907; bh=83jB+2SiUlnBFwgy4mpZgWFrRPXBFUaLgwxOj7lA4jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zwc6vUrCuPAuVxnwrTtyH75ilyXvQNII0tsfdofMMETeifMuUO4wH9Slv1kh0LCkq FNSX+sIbraRKqt+F1NgqfpfHVRrs+wi7wm73iWDfpMDRaC/+YvXcmF0gqK1+qQjga7 QdtiL9hUPR9vJ9We4Kr8Vx5MiIs0wEtiwSZw7SBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 5.4 101/453] spi: img-spfi: fix reference leak in img_spfi_resume Date: Mon, 28 Dec 2020 13:45:37 +0100 Message-Id: <20201228124942.076239473@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit ee5558a9084584015c8754ffd029ce14a5827fa8 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in img_spfi_resume, so we should fix it. Fixes: deba25800a12b ("spi: Add driver for IMG SPFI controller") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201102145651.3875-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-img-spfi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index f4a8f470aecc2..e9ef80983b791 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -771,8 +771,10 @@ static int img_spfi_resume(struct device *dev) int ret; ret = pm_runtime_get_sync(dev); - if (ret) + if (ret) { + pm_runtime_put_noidle(dev); return ret; + } spfi_reset(spfi); pm_runtime_put(dev); -- 2.27.0