Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9129355pxu; Mon, 28 Dec 2020 07:20:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOL1GyZH54DbQSnJDRnHj+u3dx5wx8a2cPfqIJokMOK2cP+g56ek2j/yaUwSAd8qCGRCNz X-Received: by 2002:aa7:d354:: with SMTP id m20mr41841295edr.195.1609168817425; Mon, 28 Dec 2020 07:20:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168817; cv=none; d=google.com; s=arc-20160816; b=NYFpOUMHY8/ClukYfks6WX/962bny2ZIhHiJIYTzxBdLsuoZ3jE4bIZG8F8qa4XREs /JebptdhGARiNhOiVQjzc0vQpr/UdhIUPyYjvFuZqfqomxBKSuyJTOG55AK28SfxfBlZ Jl+kXgL4WMfjUljqiOnb5WIF62MVq/+zxQgmZQ8jTu+hsDXMnbCjO++9i4XuvyVbptcD gHcUwUe3X99dgmXOR4jQICzWjh8K+HjhGK0lTBlcdsvUxwBNWHffEZB7PasBVnaU59oy +XgVEpx4wShFTUacmljGxFM2RyjII0sZ+EIXQIRq7u8AMm0mBdEjPpjmrz7ba4aBDEMu vFpQ== 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=fO8rx33NU0iKTe+fk+dkB3MuCPCkFp+l3qWrCNPkoIQ=; b=xwAFl2ouzBws0mFX5vGJ9xN99sCNGJKIok5AC3ulFuZAhzLWV8x8CYaPCxEmGCffB7 8rNbCn3/672SRY3LX6bI+9vHI5BMSLpE1ornrX3HtseHihMlyQSAxhqC41JmxMKlzQNr WK4m2MfZ5QLTcU5yrk5Q92ZzHG9V1tzEH/N4q6rpFuZedYsOEW7FqsFmFvCg9IclRBHM qP3pSxqaSJ4vPQ4ws79V3f2Oo0hD9RR3iF3/jZGZvM/+AL2ecgBAAhkWOWmvtHf7exBw 8H5G4WDZV5ZxyYlv23/O0eClD9N0kiFb2Pd3eMEl1SC2gD5wZ2MZ8cua0bnCYi/LFLwD 6NBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XpYwrrLO; 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 a6si18824247ejy.167.2020.12.28.07.19.53; Mon, 28 Dec 2020 07:20:17 -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=XpYwrrLO; 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 S2441167AbgL1PP2 (ORCPT + 99 others); Mon, 28 Dec 2020 10:15:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:39074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437466AbgL1OEq (ORCPT ); Mon, 28 Dec 2020 09:04:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2194206E5; Mon, 28 Dec 2020 14:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164245; bh=07JNEdDjLnMYSgegPrBwiObllEdipecUT1fBLf6AhlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XpYwrrLOLqyvhNnPSvHegYP2FAQguwGg2YKQ2SOYc4JBrOQD4cRu5djYB4g70GcAL euENdWdh0za5LXENxS3ZyNs6DiLRL7FhmpcCmQ0g/QB9gGA3FlleyUIyl4ZEduujBW uliPytxmXilq3jIOrLtVUd97pPSk1VK8awZ33PEM= 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.10 082/717] spi: imx: fix reference leak in two imx operations Date: Mon, 28 Dec 2020 13:41:20 +0100 Message-Id: <20201228125024.913281255@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 1dcbdd944824369d4569959f8130336fe6fe5f39 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in callers(spi_imx_prepare_message and spi_imx_remove), so we should fix it. Fixes: 525c9e5a32bd7 ("spi: imx: enable runtime pm support") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201102145835.4765-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 0b597905ee72c..8df5e973404f0 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1538,6 +1538,7 @@ spi_imx_prepare_message(struct spi_master *master, struct spi_message *msg) ret = pm_runtime_get_sync(spi_imx->dev); if (ret < 0) { + pm_runtime_put_noidle(spi_imx->dev); dev_err(spi_imx->dev, "failed to enable clock\n"); return ret; } @@ -1748,6 +1749,7 @@ static int spi_imx_remove(struct platform_device *pdev) ret = pm_runtime_get_sync(spi_imx->dev); if (ret < 0) { + pm_runtime_put_noidle(spi_imx->dev); dev_err(spi_imx->dev, "failed to enable clock\n"); return ret; } -- 2.27.0