Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2476460pxj; Mon, 10 May 2021 04:02:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhazLnFQIYW3xYcb+5v7oY4RMJJjWAYS+C1MjupiZU97yFkcyCoxQ7D4HW2+NychtV3MCK X-Received: by 2002:a6b:ce12:: with SMTP id p18mr17875085iob.199.1620644575227; Mon, 10 May 2021 04:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644575; cv=none; d=google.com; s=arc-20160816; b=OHhF/PTdjncRMfXrpYAzj3ysDkZUL0Y8RwXhOhLOC3CGlJ/lfaqRdRiJc0ERlJB7vp i1YS9BVLJMlgPzldnZRdoA1c1D2hxBQByu1zvL7XMwPu5ewpgNv48a6Oj2+yNpMxjbr4 9K6BKKaZuWvqR3qb1Yx0a6qE6dCMlide4rYdIvaWgFdGV9oeOKYjsMNx9CF96y/1sBp4 Hvd4OruMEAAOmr2RzuhD1NtsZni0acyQiuppSv/9NR0oPGN5ZileauLbmdEDqs5evohV X9L5aH/cjxYx1IzcMwkgqfWB7aNf5WQvRuHSj4+t9d1++VXnx4FmFnoQTwtEPMvun6f6 /WSw== 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=OWnz9E9PxHQKIhpZ8N5V2keHYRV8Jpu+wvfQxLaYzqQ=; b=wDZqoJvq+ndet7+MLHyOHVz/ab7ROggnEeeFHKwOAVSJbchNaL3NHFlBnNRdkUIL+O 4nr9SN5ybBjH8m9X1+ZOsIu5mzL9zfKiZ/6QJ4N1ADvurXVYh7c0jS25azhrQLlnN7jd 2E9a2pee9rOlgaGyh23VDMDxjukAi4NJ/+P1dQSTLN660F+tR09dhg7PiPc5flGTrY7e vnlNFphEO1UqUffrR94I2Z5fZblv1QqciKag/uTMijDJbBS5WcXjjQWBSJYaSkSV0bOu Fh4cr/Ir8LZhy2fY8vhKeOW95t3CALv9WOYA/6192SdSgvUZcxNm6mL5XUzu4gRjmwFL /1iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bod1Lv2J; 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 b14si17295254ilv.52.2021.05.10.04.02.37; Mon, 10 May 2021 04:02:55 -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=Bod1Lv2J; 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 S235326AbhEJLAm (ORCPT + 99 others); Mon, 10 May 2021 07:00:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:59674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233195AbhEJKpS (ORCPT ); Mon, 10 May 2021 06:45:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C3B5961992; Mon, 10 May 2021 10:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642920; bh=2cRVOxWvu07d3rhay8+4Pd5ur0/L9AdDDihKOFuVae8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bod1Lv2JsPmRWmrVDNGwxy39cszPSJgojDA+JQ0R1erGQUNPtRvlvTlt+eQyopc/G rNAfpO4BIBaLcUFUo3URGelEoO565PE5tJxd5TaRE2MyBRsk92rVZmkIu9+89g73xU dlMIB4X0+e+dcQqSK3IlZSadrMTBp17vwnFNXk1A= 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 105/299] crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c Date: Mon, 10 May 2021 12:18:22 +0200 Message-Id: <20210510102008.407819731@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 747bf30fd944f02f341b5f3bc7d97a13f2ae2fbe ] 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/stm32/stm32-cryp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c index 2670c30332fa..7999b26a16ed 100644 --- a/drivers/crypto/stm32/stm32-cryp.c +++ b/drivers/crypto/stm32/stm32-cryp.c @@ -542,7 +542,7 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp) int ret; u32 cfg, hw_mode; - pm_runtime_get_sync(cryp->dev); + pm_runtime_resume_and_get(cryp->dev); /* Disable interrupt */ stm32_cryp_write(cryp, CRYP_IMSCR, 0); @@ -2043,7 +2043,7 @@ static int stm32_cryp_remove(struct platform_device *pdev) if (!cryp) return -ENODEV; - ret = pm_runtime_get_sync(cryp->dev); + ret = pm_runtime_resume_and_get(cryp->dev); if (ret < 0) return ret; -- 2.30.2