Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9174921pxu; Mon, 28 Dec 2020 08:26:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHOKECqC1AjBlYTfGHB+M410Z7GUAb4ZxGMK5W3HvYYoGY26ha5eaQL1rjmstu7auwNOvr X-Received: by 2002:a17:906:4705:: with SMTP id y5mr41929076ejq.112.1609172780438; Mon, 28 Dec 2020 08:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172780; cv=none; d=google.com; s=arc-20160816; b=zhZ+amxzbbFda9lMB4SRz41/UxOKW7nVM7R0QwJO00421GohFY2o9Ys+BenKMLMelC tLiKk37I/W0KuFA8uXmNHtujok7CyAL8IMXcvA2E0H8IPaRmxj4EZFcjJoprpZrVyuuy 3KtaorQL7mgLEVpNgMGj6IPdTgR0eVpwUsWzfSxChEZInHBBr5Y7q/QvJJ9V3EK/Gxbh RF5sxrRVXe1ULBHJB4Eh2e4cUMzS2J0KwS8CyrOsyhfrZcVkMB6245q1dCrnGUHerljv 4QgJwDq/6gwgGyuQ0ANpvBeAnhC81ShPomvYFQIEiU5E5cpWaEOPS33ZYXHaEHyz1Quu f4bQ== 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=2oF2ha3zXqIafCP5ZucBr2HcSicnJLZpMaklcFiSShQ=; b=YYVxTdmH/jiYHv9ZIC2J/v4YXyRa9kiH7IOvkAaCO3odCTAC7m7e/Er19lcspg1Ju/ WOYRzr2Cbv1VSkdtjBMSWrpKpxjqDptiLz1KDRLJS8CGOh8yLesiaGm232Vy2OT/YVY2 qtz9Ot/BnM3gBzY7SJi57RluvwHW54msdkxC8HcLZjzU6jbPL4hh7axdjP7iqcaiUefb bjECpIq1nUd4EhK6R+wvrK7G2z8ovOfQUbHrT95JRoPMV5U5OsJNkuWdexnp6kQxaS1f gs7yzr12r7wvWRtJDYbLpUhiDgyWcFVTtF4dBvc35qucHlxqFmHRS6SCKvRGyeA7B8EA ZHdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZIcsfvoW; 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 dn20si21507623ejc.47.2020.12.28.08.25.58; Mon, 28 Dec 2020 08:26:20 -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=ZIcsfvoW; 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 S1730765AbgL1NLi (ORCPT + 99 others); Mon, 28 Dec 2020 08:11:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:38274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731486AbgL1NLD (ORCPT ); Mon, 28 Dec 2020 08:11:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02A3822B3A; Mon, 28 Dec 2020 13:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161047; bh=U0/U1i8HR0x+2CSCRKI1xVVEDqW7pG7qBP2HTZjGIaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIcsfvoW6gtpDFOkUJxja6fI6vP3jyWAAGQ2SZ3CQpS2qHcKq4zN6L/dkPVrony0d 0Gxm8bupuw4Mn4/CSDGWAOARf0MyYyStHwCQtSqt6zgcTrTLxopmF5MmfhGZ7jwLyo 69MrE90T6bQPIODOlC/3MZQtQ94eBmwNAMJeuKBM= 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 4.14 083/242] spi: tegra20-sflash: fix reference leak in tegra_sflash_resume Date: Mon, 28 Dec 2020 13:48:08 +0100 Message-Id: <20201228124908.777775276@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 3482e797ab688da6703fe18d8bad52f94199f4f2 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in tegra_sflash_resume, so we should fix it. Fixes: 8528547bcc336 ("spi: tegra: add spi driver for sflash controller") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201103141323.5841-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra20-sflash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 22893a7e0aa0e..749288310c36c 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -564,6 +564,7 @@ static int tegra_sflash_resume(struct device *dev) ret = pm_runtime_get_sync(dev); if (ret < 0) { + pm_runtime_put_noidle(dev); dev_err(dev, "pm runtime failed, e = %d\n", ret); return ret; } -- 2.27.0