Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2282713iof; Wed, 8 Jun 2022 01:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxp0Ze9K1OWaIg73FYTj64oaOqlepTrEPp48RT1+lE82FaxMXLJXqtMZS6OsYA0yqGCacr8 X-Received: by 2002:a17:902:c403:b0:167:4a9f:2799 with SMTP id k3-20020a170902c40300b001674a9f2799mr25469475plk.56.1654676504246; Wed, 08 Jun 2022 01:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676504; cv=none; d=google.com; s=arc-20160816; b=zIa7psgInVaLFpSkK3g6beFe5db6H6orkzq2PRoOKf2vANLhAn/yJppBdWF8yAvHKJ vWxgcltDdlQUqvGrUT8ooUrlqAXwHBy5HBB3RPIw4idDjwD4GmfXyrxXTHyfe2WxeUEV OoyzoKqrAlYn4Lw0eLF/egDkqsm46Ccm5lald3tDSFgpJfZBrDTAXmrUTmFYjuHi9R95 Udd0NnCUiGHnl7d87ZofXRHSWDP5Pw/10WF696cer1E2lymcp73gvV4Oqyt/47FVXgMt 2UpR0Y/m947sFVBuSu89riIoT+nTpwxFRknSCR7KzduUSbDvZZVV/bO9HMPAmRVHPoCb ALew== 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=DzdYwsV9Dxnn9X9YutScMXTI277QxdbLkGnSlOD2e1s=; b=u6Z5j1NfBzvMZsPOTEP23eI+8iyXq+v6rkWH4+WXUusTS+YbXAifyectQoRA8jgxlT YJjGxXawBE5dZmLzcJWlN/RrnCNXgDpKKdELYsxP73gzLVk34AHJLS2RYGcL4g4Yrb8/ Ml1V7L7RbPlSvXntB86jEUcU+W/OhUpNrLgXtBgY2TySIXNpbpzdolFn+GqhMq7wU69H ENKsUhmxmCwgn8RdR7eloDOrUC/Gbk9LGEwoLJowlnEZOQ2w6aQYU39e55deb3HAKxp+ jFL5EveOgn1s6Dv6OJfsPshKouOOV4xdkWt6Sn6oeoW29DQioWEQmycbKUP6A11B6S9w AmkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ut2oZ1Py; 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 p14-20020a170902a40e00b00158e566366dsi25469081plq.366.2022.06.08.01.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:21:44 -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=Ut2oZ1Py; 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 9E42820E50F; Wed, 8 Jun 2022 00:51:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386528AbiFGWtC (ORCPT + 99 others); Tue, 7 Jun 2022 18:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381329AbiFGVk1 (ORCPT ); Tue, 7 Jun 2022 17:40:27 -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 9761318FF18; Tue, 7 Jun 2022 12:06:46 -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 AFF5D61846; Tue, 7 Jun 2022 19:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8E73C341D3; Tue, 7 Jun 2022 19:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628805; bh=o2wbFfEQvs2eiY4N0Y272HxREAh16iSWwNULUjZBAAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ut2oZ1PyvOy77mRkIebEpifkzaHXJQQai0720S7jQBo3Rl3D3OWlIPKLBPwL0szC4 R0NE0j5fgBxek64XsYs0pAPk4MB55qsyGSpedqdPA4UPaJwLaV25pHkRssIJeODH83 j5qpqTOMYp+DC9xr98qzgFH/M4GG6uTkCKyB1Kjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Pierre Gondois , Vincent Donnefort , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 421/879] PM: EM: Decrement policy counter Date: Tue, 7 Jun 2022 18:58:59 +0200 Message-Id: <20220607165015.084278018@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 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: Pierre Gondois [ Upstream commit c9d8923bfbcb63f15ea6cb2b5c8426fc3d96f643 ] In commit e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq"), cpufreq_cpu_get() is called without a cpufreq_cpu_put(), permanently increasing the reference counts of the policy struct. Decrement the reference count once the policy struct is not used anymore. Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq") Tested-by: Cristian Marussi Signed-off-by: Pierre Gondois Reviewed-by: Vincent Donnefort Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- kernel/power/energy_model.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index 0153b0ca7b23..6219aaa454b5 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -259,6 +259,8 @@ static void em_cpufreq_update_efficiencies(struct device *dev) found++; } + cpufreq_cpu_put(policy); + if (!found) return; -- 2.35.1