Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp477296ybg; Thu, 19 Mar 2020 03:19:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs42KmBm5aStFBsOgrXJMiKfpnn9twe4SBfEpFEcna0B72mskndiBWJHY2OR/We87tooLVq X-Received: by 2002:a9d:2f26:: with SMTP id h35mr1581170otb.246.1584613191931; Thu, 19 Mar 2020 03:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584613191; cv=none; d=google.com; s=arc-20160816; b=lx+g2WwobKaAtCwGMWasXte7xBNLiDulA9DjDS4zvaWgxO5kGrRHSvFBioaVB+r/5A +wNn6vlaBK56o/uVdLP3ctuBewa685/Gycp7tR4LmVWp0zxQzy/9cx1yV5BRI8XhtOSB rfKHyL3O19GqwfweBQv9acFRbBNmkPuLZ7FapkxpYSRNPkJYqFAF//Kca2PjSFQGh0Oy zlmtllLc+cgv3QiHd/wtAl6Zgw205elZGsAhsTcnRHT/CG5Z5L6ITFbeRjrj18212JdL aRnlphp+JvvpZT+wAnP6/n1t+3II/ZMTwSe03gTmkjIJFq8aPPK6zRJ+LUEG1RIgYe7o teKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kJciBt923w9CZJR9Xva5pfaJHJ8rRUFDZlkhMv6O1/I=; b=skv6QOzPKLlU4sKPG9nBlGiIcljeR6WAPa6JsVBXiG1C/AlCUVwuZM5Pz5fkf4ryxp bXkpTmFX/7Blcw08VDtjEm0YEUSVOfrQS3+0ZY456nW5G+IflJldtv/tHDftNeKercpT YC6eOpIDk+HGygudTANB1iiqOTHFusGlIUEGfGmjZk5d690o2MyEh4sO8jjNL+bY/kKX e9QwbDmKiEv/WbWfpgYhhwBg9Sr8auGxyDsaifvkiQlvsF+DYyF3g3KCAbnDaJhe1Oeq mtYzmAkw9Mtz/OK+rzjm/e6AXnWxDM/QzZnkuYrs3fr6hS0/xm0n6AOcl0xSin6U3CqA erIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si1002124oti.165.2020.03.19.03.19.39; Thu, 19 Mar 2020 03:19:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727023AbgCSKS2 (ORCPT + 99 others); Thu, 19 Mar 2020 06:18:28 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:50372 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgCSKS2 (ORCPT ); Thu, 19 Mar 2020 06:18:28 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 723c13f3574c4ab3; Thu, 19 Mar 2020 11:18:26 +0100 From: "Rafael J. Wysocki" To: Pratik Rajesh Sampat Cc: linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, pratik.r.sampat@gmail.com, ego@linux.vnet.ibm.com, dja@axtens.net, Michael Ellerman Subject: Re: [PATCH] cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn Date: Thu, 19 Mar 2020 11:18:26 +0100 Message-ID: <1921198.IfoiWgUDIW@kreacher> In-Reply-To: <20200316135743.57735-1-psampat@linux.ibm.com> References: <20200316135743.57735-1-psampat@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, March 16, 2020 2:57:43 PM CET Pratik Rajesh Sampat wrote: > The patch avoids allocating cpufreq_policy on stack hence fixing frame > size overflow in 'powernv_cpufreq_work_fn' > > Fixes: 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling") > Signed-off-by: Pratik Rajesh Sampat Any objections or concerns here? If not, I'll queue it up. > --- > drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c > index 56f4bc0d209e..20ee0661555a 100644 > --- a/drivers/cpufreq/powernv-cpufreq.c > +++ b/drivers/cpufreq/powernv-cpufreq.c > @@ -902,6 +902,7 @@ static struct notifier_block powernv_cpufreq_reboot_nb = { > void powernv_cpufreq_work_fn(struct work_struct *work) > { > struct chip *chip = container_of(work, struct chip, throttle); > + struct cpufreq_policy *policy; > unsigned int cpu; > cpumask_t mask; > > @@ -916,12 +917,14 @@ void powernv_cpufreq_work_fn(struct work_struct *work) > chip->restore = false; > for_each_cpu(cpu, &mask) { > int index; > - struct cpufreq_policy policy; > > - cpufreq_get_policy(&policy, cpu); > - index = cpufreq_table_find_index_c(&policy, policy.cur); > - powernv_cpufreq_target_index(&policy, index); > - cpumask_andnot(&mask, &mask, policy.cpus); > + policy = cpufreq_cpu_get(cpu); > + if (!policy) > + continue; > + index = cpufreq_table_find_index_c(policy, policy->cur); > + powernv_cpufreq_target_index(policy, index); > + cpumask_andnot(&mask, &mask, policy->cpus); > + cpufreq_cpu_put(policy); > } > out: > put_online_cpus(); >