Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9173410pxu; Mon, 28 Dec 2020 08:23:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRsF7ytZmWnZKaWstzIWGNLfA7JIaHUshsDyzy6J6VN82dUIo+ODy19qKzUTgBlpalmn0r X-Received: by 2002:a50:d5c1:: with SMTP id g1mr44353024edj.299.1609172637632; Mon, 28 Dec 2020 08:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172637; cv=none; d=google.com; s=arc-20160816; b=DEUoiB9E0JGhdvHmDBtiacEODFUJvTFwSPXQvOlZ8xuhwBk+hUWoARSoMXerqIKRL+ 1uN1+XKXIdq/Nd15Nej60Z1JXeJLZ5mp6JId6fmeWsLPqc373IOxfvNeSK/ywtWFrQ6F sVaSXnSIe6r+2ECPY/t9jDf06tl2wH6j7Uu52OwIZ2sBMSdEWlNT2i7sYe5pJNr66EjO DDFz7Ox4gZyYkWJsgiDBq41gZQiT2UepXtp7C4MYOixNUnhzKQ5BgkVsO4gTYheNybjC nlH80c/cpS9W17nXlLO2mqzCcUfqnfxt6InY5dJSZVZJDf2g+pghCgGeNvxW4zyV5zTV s7uQ== 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=qaS2pJNvllcsO/yWGjA6HKupcI7G9koGL/9Gsx95Zne5t7R0WuNrr/kL2o6ezFVFk+ of1bdwZqIW8gYSP3ZTMm7f33m6TQKAsDIy62rpU8EBHgZwc/zDBQ47CFptr6Kxk3OjVO w5fXRfklzi8eqTgqqg4bQVgLOtPazsnLL8OXv44my+RjNthUw1/eMaDnO7CKOy8BxGXc B5bN/Q6CWBzXnfrJHrVlnF0864Qp7EMEenOg8MuD/zzz95zXk3jcuE/pVe6ovxhxpEm2 p3bWm8K2uecHuQg5j82/VNBM/slVUTLIsZ398VQWm+fiTjq6b1V9+CB4v9dMQea/3C/m r9hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oMHolew5; 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 y26si20828532edo.273.2020.12.28.08.23.34; Mon, 28 Dec 2020 08:23:57 -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=oMHolew5; 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 S1732061AbgL1NM1 (ORCPT + 99 others); Mon, 28 Dec 2020 08:12:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:39566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731968AbgL1NMK (ORCPT ); Mon, 28 Dec 2020 08:12:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45E93206ED; Mon, 28 Dec 2020 13:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161114; bh=jxrjnqIMyw4tF0dbRn8yKHdCEljgt65L9YbVWa44q3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMHolew5Nn7E4p+FE+YcsmuwyBEkemDodOcUqfzLMr5rSGunQrYFd6CEeKlD0p3j6 o5/pikJLMcs2f5DYOqt3OV9xWY6xZCUvXFr81sWCiBY4P57HHeBR6/kCq26nFbXCYl uMpCEVU/tFuBkcTLr3D9w8OtjL4f9dvAaZW2+wkk= 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 076/242] spi: img-spfi: fix reference leak in img_spfi_resume Date: Mon, 28 Dec 2020 13:48:01 +0100 Message-Id: <20201228124908.428565523@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 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