Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2476333pxj; Mon, 10 May 2021 04:02:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDTlMjqFpIM+XP0WNHwSERxpxxdHbsObU3wGbVojLKylSeRXq896MmDw/5yOnEpladOgcR X-Received: by 2002:a05:6e02:1a27:: with SMTP id g7mr8588657ile.304.1620644566307; Mon, 10 May 2021 04:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644566; cv=none; d=google.com; s=arc-20160816; b=baOZj21q8JNVVIbRs9rj3kBzQMV8BOOzq+Rzu5DvlQkG3KGm4/pU/Z8gn5HcPElmQK iaZ2Tri7ZAEfhZ2W9giSZTWmTajH/GbgKfx4moxLJCEnw2bF4pcpwGa8gsjHb9NUW1Mf GmrO9F1sC53loBd1HIWqWwNbBxVobz8GAXVZleI0D4/FI3ptITl+SJ8Yejby3jjGK/go m4qbXiGUmP6AOE55qC4jMpfS5q4eFpzxCskDhf7LhUu0zgh1buvsPKMNQcOm5ieNkds1 2h5kTNF2Fni65i3vEdNf0JvwgqkoeOU1TD3QX6G2txBmX1RKXDn6MyEOymbW2Zl3+cYw 8Lbg== 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=ahHQiSDCPAtZU3aA1uh3HeaHcZRg8ZDE9eapx67bSYQ=; b=sDwD67ghdBEeGBw5TPjWZO6KsCljyjulrYU19DNJRELXCkpxjwUA4puCI3EJmcMao1 ZcHQiywx1MpVFVn7PONodYhxU4SlFDoCx6jjaJEUSIGYrQ16NrzoBSHx3HdG1silmhhU FQP2PxYug3y9laCKZ0rGz/2EbQiDLQMqARvwUNK1MjKLERouzkHb/9StBxf/bwMOtMPq FgByHt7MnzcnL/N1SSTEGAg5JGCm3r+idaSMrYWYladWFHU+pU3I117ltNaaomCgSw3o kmffQghIfuGhzkTAHu5iIAdInmW7rn5OTaqg5MuiCR+J538O/N+LOHkFo6lWlHB1A9yt J8PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bRALIAf8; 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 n8si14596327jam.34.2021.05.10.04.02.33; Mon, 10 May 2021 04:02:46 -0700 (PDT) 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=bRALIAf8; 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 S232265AbhEJK5k (ORCPT + 99 others); Mon, 10 May 2021 06:57:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:59640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbhEJKpQ (ORCPT ); Mon, 10 May 2021 06:45:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49F1C61928; Mon, 10 May 2021 10:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642911; bh=6nfKnmaO/Jr+W8MVnfjgZR/sXWTOTqfJ8mZR4HK+ick=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRALIAf80FlGehr65xdFe4BrOb7qdkcaPHYNh2dMfwyj46mqTJAJhqcRRQKHVj/IW LGJ7JcopzB+qhNcvyI4pbNhhg3jknsKdJvTUVk6JapFFCgPCU28lTqRNSQYAChMbU+ wNw9U86cLhxh/kTAqlwKIuCbK91FlXzN83Zf2tro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shixin Liu , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 102/299] crypto: sun8i-ss - Fix PM reference leak when pm_runtime_get_sync() fails Date: Mon, 10 May 2021 12:18:19 +0200 Message-Id: <20210510102008.299642049@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Shixin Liu [ Upstream commit 06cd7423cf451d68bfab289278d7890c9ae01a14 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Signed-off-by: Shixin Liu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c index ed2a69f82e1c..7c355bc2fb06 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c @@ -351,7 +351,7 @@ int sun8i_ss_cipher_init(struct crypto_tfm *tfm) op->enginectx.op.prepare_request = NULL; op->enginectx.op.unprepare_request = NULL; - err = pm_runtime_get_sync(op->ss->dev); + err = pm_runtime_resume_and_get(op->ss->dev); if (err < 0) { dev_err(op->ss->dev, "pm error %d\n", err); goto error_pm; diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c index e0ddc684798d..80e89066dbd1 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -753,7 +753,7 @@ static int sun8i_ss_probe(struct platform_device *pdev) if (err) goto error_alg; - err = pm_runtime_get_sync(ss->dev); + err = pm_runtime_resume_and_get(ss->dev); if (err < 0) goto error_alg; -- 2.30.2