Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9182099pxu; Mon, 28 Dec 2020 08:37:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS9w+kgy8JcDNTS501jc50I3IY8JKFrjyefabR5WgJ9Bc7IHJOIg9FbW+VYS9VYvDkFobH X-Received: by 2002:a05:6402:a5b:: with SMTP id bt27mr43415866edb.222.1609173449321; Mon, 28 Dec 2020 08:37:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173449; cv=none; d=google.com; s=arc-20160816; b=ZvPKCk6xjvzfQcxxxvrz3FIawaBOlpJj6SgKZG3XwzWtKqsMO0MSa9jS3apiYsyQ8y BIqIczAcaUnWWvU84LYUc1YApWQTyGJ2KFWVMWkeaWYuav2YTauqACqqCi3rt6IP0GW4 9+6k1Ql8MW96CAMqIBDvrTRPMe11JfhurVTqj7fV2QfSL2DkxqdDnEMwU0J1UWYxqkWP PoqkC0kav8TE2MLAAkj2zMvSXBmtXYCGM4wNRpifdXmkk8I6qVAHKXIOI5zjXF8skt93 0LfWzzj+XPr3bCC82/yPJh/mQatmvtRa1I7xuB+OXfulecxuarex8MNKrWEkCwblzDpa scuw== 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=K+uKl4RZDdB4ZIWzPB1sOeNqL2C10fu1x0qodxfLFv4=; b=CksORBetRPhIH24gvdfTE8ADZ46fS9Ti1i+vcjmffnGltdAvYswJ1DJWHkneTB3cJY lwtsONXa7c0zctIxbgYt9QSV0CbgO1yngsdDJjmWp0LC7k385ulqaWLEdZx57qYodC5r 4Fulf9n9Br0zMTnHVXoNzwMfXYwSXvD1CBaKbh/cjHX4HgUrd2DGrJkq7jrs7d6F5exX Eml/qGcjHShEgMbYKPiBGjJtCVsu5/uqRHhXU1j7K5TReXorZj1BynToXpH2RqpXT23r p2ntt63p+hE2RP74p2xNHE1vyQVjEIuoTpAnJrsVtdxRzeMUU/340a5VOwJ5uhOiBnzN RWUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ajr4PZID; 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 ot14si18538987ejb.493.2020.12.28.08.37.06; Mon, 28 Dec 2020 08:37:29 -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=ajr4PZID; 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 S1730229AbgL1ND3 (ORCPT + 99 others); Mon, 28 Dec 2020 08:03:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:59348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730189AbgL1NDN (ORCPT ); Mon, 28 Dec 2020 08:03:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1455208BA; Mon, 28 Dec 2020 13:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160552; bh=Umn2im3wKL1U3i3xsCfO0vl3cKxcFTZf51tW8yz409Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ajr4PZIDHUYnyjWdWCnz8+ro5Nme+6d1VZl2+nSjF3zejxRmLHccKeMEFF4sp+RAi QJAhelhbXttBwqAUKGtqvZmyDY0ICI5fp7F2zK9NYWViZT26bdmXrSgTzZ74Be4zqB XMm5MSVuOcUaG9UKq+vMHvQ41rEtojNY87l8Sw34= 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.9 060/175] spi: tegra20-sflash: fix reference leak in tegra_sflash_resume Date: Mon, 28 Dec 2020 13:48:33 +0100 Message-Id: <20201228124856.163817016@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 b6558bb6f9dfc..4b9541e1726a5 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