Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp529377ybb; Fri, 20 Mar 2020 03:39:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu+P+SjKlGFOr2l8Ptms/DitFTeGth6A8nrl1tLqtXxX0PKj4GlS/WDniAOj44H/5rUT8Te X-Received: by 2002:aca:ed4b:: with SMTP id l72mr5552134oih.95.1584700754310; Fri, 20 Mar 2020 03:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584700754; cv=none; d=google.com; s=arc-20160816; b=MsDk7p5QK+N4HreUdukl/g3N+9alrroKYLeu04kMq/eZlkgaT8XEifkTTfpNnTjQjS abCcwAhSCMCsy1Oob8g0K5e/13UbT+vHi8GJNj4kbSjsAw7j+JcqrpK2/PLOghCmeIk2 zv3Lxm/nxJEcg3wxW6iOfRLxdMooCd1EYUzFSO8EvEHZI+S6XEiYgSVN1MmmWLLfo6XV FWIO3Aiyj57GRuktjH/32gjmYKvuqd7eKD7BEBWE2cPre9a5JpnTRGjjMcWFFh3jMZX5 B1KLU3hcPQLziHUq/IrILnIvuDBKtwHkYO2pxvI58poVcw9T18+H5iw7W76eRN9l2Rsx Pefw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=v5tx5xRPD+cbcx0OyJPIXarOou+ldPavc7U9tGm5XQk=; b=juuWPn+lOr+pDWMTy2mHcH/U+hQlLOCVxnpPGwQQUdFS/jiSwtFwfzzLXljZI+3NY+ lH15a9elUCRZSoYlL/c8Jol842mg9oOnthKBOvdXLLJzzqcgDUDTMs+sYMdP5rfvNt4r N0I/VZiz3IeEqmmEnqLtj9FppHOjtmVM9dYYwJcdSa2qoxKBfy/wkb90KUOuuZ1G7X/p bI9qq4+T7Lw04+If+N5o13LsT6U8DgU4RDkDuKw6+UWi2AKO2vLTc7MxvuuxBVK2SFq+ AgwPVak4Mwa5j5kHq8kVdZpGH+24cpeKTn0mjGozFqWKJaUqVFR1ksziy5i1MPwZWiyA fwbQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j23si2771366otp.31.2020.03.20.03.39.01; Fri, 20 Mar 2020 03:39:14 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbgCTKiE (ORCPT + 99 others); Fri, 20 Mar 2020 06:38:04 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:12634 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726704AbgCTKiD (ORCPT ); Fri, 20 Mar 2020 06:38:03 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02KAXQkl010252; Fri, 20 Mar 2020 06:37:57 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yua2d8h0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Mar 2020 06:37:57 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02KAYuRI015525; Fri, 20 Mar 2020 06:37:57 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yua2d8h0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Mar 2020 06:37:57 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02KAaAPe029535; Fri, 20 Mar 2020 10:37:56 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma03dal.us.ibm.com with ESMTP id 2yrpw7bbaa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Mar 2020 10:37:56 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02KAbt3t54002126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Mar 2020 10:37:55 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB5DFB2066; Fri, 20 Mar 2020 10:37:55 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4ADF0B205F; Fri, 20 Mar 2020 10:37:55 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.85.67.27]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 20 Mar 2020 10:37:55 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 47B522E3408; Fri, 20 Mar 2020 16:07:39 +0530 (IST) Date: Fri, 20 Mar 2020 16:07:39 +0530 From: Gautham R Shenoy 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 Subject: Re: [PATCH] cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn Message-ID: <20200320103739.GA11219@in.ibm.com> Reply-To: ego@linux.vnet.ibm.com References: <20200316135743.57735-1-psampat@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316135743.57735-1-psampat@linux.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-20_02:2020-03-20,2020-03-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 clxscore=1011 phishscore=0 priorityscore=1501 adultscore=0 bulkscore=0 spamscore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003200046 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2020 at 07:27:43PM +0530, Pratik Rajesh Sampat wrote: > The patch avoids allocating cpufreq_policy on stack hence fixing frame > size overflow in 'powernv_cpufreq_work_fn' > Thanks for fixing this. > Fixes: 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling") > Signed-off-by: Pratik Rajesh Sampat Reviewed-by: Gautham R. Shenoy > --- > 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(); > -- > 2.24.1 >