Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2120564ioo; Mon, 23 May 2022 10:30:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyefgJG8f8rCaENjFgO7LsLov6h+AvFsF4VWPV9N+5GA8QJxnmlwOEzVUDCTTMyhVsVI0no X-Received: by 2002:a63:2358:0:b0:3f2:6955:aeb with SMTP id u24-20020a632358000000b003f269550aebmr20493695pgm.243.1653327006794; Mon, 23 May 2022 10:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653327006; cv=none; d=google.com; s=arc-20160816; b=nuCdKOixOGxtnM99q4kHRbpcocJ1QxDRSRjnI9evvC1epJto0wMVggKhbBTFfk3nVv kntno+knvdI16cr0Qe4oBUQ8hUCPjDuFvcaEKRTr3l1oRj1d0FsuchkIXOsIi6i1XiyH Xlm9h+fK8JedQf58sh1CIAXDkSi2Re3Jxn5c+Z5KKSuH96sY/oN/k7sRyqN6kkLV3Yf6 H7HA08dc6BzIhj8Ev4MSiWpIZqMFQksJ1XE9Hbkwf1+psw8im+ZAf5g7RySnoUI6Le0w XbZrdgM7nBt6WhAuE5Wao2Ay27pOnWbTGc6SDdTZd+c3MEPo6rBOTL691YjDPAqjL4ff h3Ig== 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=aDatOE/hM+kbD5fty2fgnyURTkouUWSOCLoTIQoQoe4=; b=z2D/GVPH+9KxO6GhvUPKXtFgk0AOpSmtrh37xeFWgFYLqas+UaouMoZh/6gyzWKIlH 5s+ZtI5BrTJIXV5eznnraokQ4nDtiQ0CPshrovTXz1dJOVzECGcX3rERLzooMg+bV3Du Z/nn7yAO70GgWNcPfpS4NNgdSWbHyzYjH109owmsHdvnr6YTbSc1y38VaQNae7CL22WG DridF/wpRpCN2AhYilR8RjBwsIo6gz74irhOWdBwtPxqQv+LWDt7zPOtbu+00VhNHFWk kjstSvmPXTcuAaDEVXXGZl8DP3FX8LRRbjd2trsy0vBzzJVMHIgGnsor3ctaKlaNc2YU dGEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e1nXA3Qx; 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 m13-20020a170902f64d00b00156c083f7f6si10147389plg.567.2022.05.23.10.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:30:06 -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=e1nXA3Qx; 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 6D80085ED4; Mon, 23 May 2022 10:29:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242295AbiEWR1g (ORCPT + 99 others); Mon, 23 May 2022 13:27:36 -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-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 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 *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