Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2109601ioo; Mon, 23 May 2022 10:15:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLJdixa2zSYvfeueKFAtdPrLas+SAkcS9DwDBq/61EDiGvPs7UGkCg4RdQzFbC/Fqo7Y1H X-Received: by 2002:a17:902:7049:b0:162:962:5b04 with SMTP id h9-20020a170902704900b0016209625b04mr11599491plt.167.1653326101922; Mon, 23 May 2022 10:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326101; cv=none; d=google.com; s=arc-20160816; b=aI+FqX2iWtnFl0Q7R19Cdr05ls/4IWiAcqrrgexUKwgcMxuyH4SutLE9O+QMqK6o01 q4EM5l1EFUZd+cVrsZM0HP+8RHPMiHw/+3M4tBo4XFu//dmQcRYNtBJAVyg23A5Y6WHx n6vcgPR6WmXUCTgZ44/78ozE4d1XFRaBE04jN0F0qj4MwwDJDNopj0TLAXuZOHaIkvN/ v7Fkz3sTOT9wd4KumoJWkbD18P4APUdDzOxAWvozeSS7sTdIbobW8/cI10dB5eEeO4/2 UmQEDMKJniyYj98mDLLcyi9k3viSjdBCwm+z2OtAJTa+Fpf5lrCdGbEVKaQs0jNKgctC u0JA== 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=CRy0vbiWDfUTzWbriDy5lkgZf8TXmp04KQdYCX5UiDw=; b=PDTRNW/pYGNbQt8DbAvoSYBO0tf1wqPDYnETp1kMDMEhccRKegGXRoHpaMVpVjd5BH Uru3s4lSuAn5tHLVtI5tCFk4ENX8CruoMpcE8ywM1c7d15Mcgb69FWJauPKgvHoFmoKg IiFQWFWiOXTVEp64HJJQ3LvksBk76US6e5A94qBZU8U4m7lfCL3CdYl5e4VKm9g+qfFu RE3dfMFaznXnAr/IQunYOSz2tZe0zUpEvOAmYftK16Aylv5OSrMmGnX3ZmHj1VTqn0vW PJAgdqPEysJ7BquP114hY+CJPH894sfg0CoM/Dq/o8zfOUcOH3UUBwpwqa0uE9/foD6C 8HHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EIiREeA5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z9-20020a656649000000b00398ab3fdcafsi10226549pgv.655.2022.05.23.10.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:15:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EIiREeA5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD20A6CABC; Mon, 23 May 2022 10:14:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240020AbiEWRN1 (ORCPT + 99 others); Mon, 23 May 2022 13:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239975AbiEWRLa (ORCPT ); Mon, 23 May 2022 13:11:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD366CF69; Mon, 23 May 2022 10:10:50 -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 CDAAB614E5; Mon, 23 May 2022 17:09:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACF65C385A9; Mon, 23 May 2022 17:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325793; bh=rtSw1l7QdPTLRBp089iUJcQX1L9N+GkfaDN1OeqXWJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EIiREeA5CJbZM0DnvwpZBoNzKWr3dg10uIWQIR3slARymuaQiNkhdMZi42IJk6Nob qf2uUUcWsGfpGShL16H+thR3YjbFi5GCqzrfZPXII22wAdzlLXHG43dy+33vLNjuXB tk6lrjSGmZWD0MCc4L8ett0m7yA9D4WYax28M4ao= 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 4.19 05/44] crypto: stm32 - fix reference leak in stm32_crc_remove Date: Mon, 23 May 2022 19:04:49 +0200 Message-Id: <20220523165754.415952096@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/stm32_crc32.c index 6848f34a9e66..de645bf84980 100644 --- a/drivers/crypto/stm32/stm32_crc32.c +++ b/drivers/crypto/stm32/stm32_crc32.c @@ -334,8 +334,10 @@ static int stm32_crc_remove(struct platform_device *pdev) struct stm32_crc *crc = platform_get_drvdata(pdev); int ret = pm_runtime_get_sync(crc->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(crc->dev); return ret; + } spin_lock(&crc_list.lock); list_del(&crc->list); -- 2.35.1