From nobody Sun Feb 8 11:43:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2C2AC43217 for ; Mon, 23 May 2022 17:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242324AbiEWR1j (ORCPT ); Mon, 23 May 2022 13:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239994AbiEWRPE (ORCPT ); Mon, 23 May 2022 13:15:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE5BCFD2F; Mon, 23 May 2022 10:12:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF141614E9; Mon, 23 May 2022 17:11:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8129C385A9; Mon, 23 May 2022 17:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325908; bh=EWPceXRr9n6C5+usxhB70r1p1I7AsLGL6Q2JN/tDL8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1nXA3QxBwrOfVuwX6aGm50A9DN5Yrwi3ZtIYjeVJ4mpbfDS/iYkEbBasg0d3w8+H rqKJhlycpodnjm/9O7Xm/puy3R3Bqxq3ZKETdasG6vyE0E2lx2xFWjt8h0swO319k1 RqdEBADeOqep7+rcDx8YPFdaozGnbz75s66xtJRk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 08/68] crypto: stm32 - fix reference leak in stm32_crc_remove Date: Mon, 23 May 2022 19:04:35 +0200 Message-Id: <20220523165803.930545313@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheng Yongjun [ Upstream commit e9a36feecee0ee5845f2e0656f50f9942dd0bed3 ] pm_runtime_get_sync() will increment pm usage counter even it failed. Forgetting to call pm_runtime_put_noidle will result in reference leak in stm32_crc_remove, so we should fix it. Signed-off-by: Zheng Yongjun Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/stm32/stm32-crc32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm3= 2-crc32.c index fb640e0ea614..2ecc970f5cae 100644 --- a/drivers/crypto/stm32/stm32-crc32.c +++ b/drivers/crypto/stm32/stm32-crc32.c @@ -332,8 +332,10 @@ static int stm32_crc_remove(struct platform_device *pd= ev) struct stm32_crc *crc =3D platform_get_drvdata(pdev); int ret =3D pm_runtime_get_sync(crc->dev); =20 - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(crc->dev); return ret; + } =20 spin_lock(&crc_list.lock); list_del(&crc->list); --=20 2.35.1