Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9183334pxu; Mon, 28 Dec 2020 08:39:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxV42R999PfCYvU13pCEKFNf8mPfXNX53i+cE8d52Ya/H9Hjtp4tB1N/7E+U2rMQKQYDF8D X-Received: by 2002:a17:906:298c:: with SMTP id x12mr42124462eje.244.1609173584831; Mon, 28 Dec 2020 08:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173584; cv=none; d=google.com; s=arc-20160816; b=M5uAr0i0wHo1ZkUd34yeDTFKMRlJuaYXlePR2N1dEG2Ny6x1bBNlNkX9AbN1vQo68N wjb+5clxactxDk1ZEe0qKhtpUK2bifxkqf7+V5gany3rNWj4ORzmk5o+nmxpF6mneVNP MGZXu0O7P6VPrO90faAMMA5ffB8sU8mENFsYQogD4NFvHm278x7Pm46KP3Tsq/ybOQmy t5h89QlHTkdfwlb8NhgWmNXWe2Z3hLQClXYN6OxcSL4Zjl5ej3yt93awC/AIm2rlzsKK 7EiB+Ad77RBTujvVDS4v0spU463DoWvmXx3bDXoEGfpqBunL3xFvT88rKNENjl6K5R19 G3HA== 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=GgZuQw+3O5TVNqgkQEdWyysqz/Q64PN5AUQRtXqIWPU=; b=PP2YQtU8IJkksmEPMRjn+QCnhyFL00c59Ydr6RSAMKMdrFWZeWyx8NM2Tvvy6y7+NM q7fhP6zgSpQGxtCCo6NvS4/LUmzpYYsAhj6u2ph/2dqT3Mg2HrLu0lQPrFq2gv6UTEZK n1Ih9nmcIBDUJGTdAaThGrJjBatK+/Pky9W4A+9Yth8L03XOcUeS3WsBOD/OfzJW5Xbj Aaej8vZfXEYSjyPR0vxHc8+rKwWIKDlpKkiMwTSXB00a1z9I35zgj2WaVLQ13qPVZXza a39s6LrMReFIvGsWOUeL30ef6N31DvnNKDYsoYYZqPZEJj74fx/8zj96V72tFYl2+fWb OJiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=11inM8qX; 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 ov28si17080792ejb.512.2020.12.28.08.39.22; Mon, 28 Dec 2020 08:39:44 -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=11inM8qX; 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 S2633702AbgL1QhZ (ORCPT + 99 others); Mon, 28 Dec 2020 11:37:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:58074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729851AbgL1NBs (ORCPT ); Mon, 28 Dec 2020 08:01:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3947C22573; Mon, 28 Dec 2020 13:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160467; bh=jxrjnqIMyw4tF0dbRn8yKHdCEljgt65L9YbVWa44q3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=11inM8qXW/iwVHi1fLCdaP8AKEZa4woZ/CQujPq/IQFTASohdDo96PsFcI1+x0ccP kA6avLqL5/nH6SbHh7SoH88vIhgfYVLuB1EwVgJgzxuXgPfBt8+WOSZfejJ22vj9xL Qz7Fsjvl5kvlsl97tO8C7tsats4pkR+lpeZZ/Rt4= 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 054/175] spi: img-spfi: fix reference leak in img_spfi_resume Date: Mon, 28 Dec 2020 13:48:27 +0100 Message-Id: <20201228124855.874677417@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 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 2e65b70c78792..2a340234c85c1 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