Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6711701ybf; Fri, 6 Mar 2020 03:07:05 -0800 (PST) X-Google-Smtp-Source: ADFU+vsFDa7vkCA5DBV4tiOuMotGQWNPdC1Jw+fdrFZfdd0Odsydu2GxnF1vNaW40bW9N6KRHXSa X-Received: by 2002:a05:6808:34c:: with SMTP id j12mr2019076oie.92.1583492825756; Fri, 06 Mar 2020 03:07:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583492825; cv=none; d=google.com; s=arc-20160816; b=PslFre4oP6yPgtOrclOLr4fs9QrRMvL3i/fnqpJhDXvWCTfuRqX63CPZ2e8Ty40nmo OoFY3qJjbFZGL9b6c2LytqqgRH+jFbt6l5PCJDzlKoAv+cbV7/m+Ew500ETArI6qLn6n boZ4Og6fZaDJJs8gln/cXka0nzVYzIMZhESNAr7FeWvoiVqueeJsxAuRfWCrtZlv7cRh JyySyb5RbMMLv2bi+Ir7wg+U+KeG5DM7g5HEtOrHt47SDIrvG2Xa++zx6YaJ74y3yuIt iMV6Cb3BYtyPYMlehhvmPX4vpNYlmD8v1FdoP8bR8rudLmu0t4MPWei/BI/oTPrgpMK7 KD0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:to:from; bh=6mbu/s+tVL6c/4oU8aA1OQ2CtgGRp/nFXSgta1E79bM=; b=f6VphJkoiJvVFlV+hFXBLtgeJZQ7ZKH6cm5ptO3XevmEmXoUzQ7esV92OL+Q/oEHr+ EHFEoCH5jBUw6anVJ7yvFn3ggFEio0bQr36Ez0bXdJaYzMykGsqcUulSq59Vc+f4id7F ctbdyDcn1TP7yPeewBp+h/2drVzl1NnD6GoQAg8Jm+g2Tg7Hja1cGKSB3kWyer3OZF2c FClID9fAFk0uNQC6tM3kFrY9h66l7l7anZXnjzEPvra0ZIld84RcMsRlcigrK/PiNNU9 LfQEM3+A53ISKcnsGSNUOspgip0ZvLIFohauEiHbQ09UYuszKV4FbxfyUCU20uILFo2S gRcA== 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 q126si1087591oia.8.2020.03.06.03.06.53; Fri, 06 Mar 2020 03:07:05 -0800 (PST) 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 S1726866AbgCFLF6 (ORCPT + 99 others); Fri, 6 Mar 2020 06:05:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33546 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726171AbgCFLF6 (ORCPT ); Fri, 6 Mar 2020 06:05:58 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 026AxSHG008813 for ; Fri, 6 Mar 2020 06:05:57 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yjx0656r5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 06 Mar 2020 06:05:57 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Mar 2020 11:05:55 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 6 Mar 2020 11:05:52 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 026B5pCA59506800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Mar 2020 11:05:51 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36FA142042; Fri, 6 Mar 2020 11:05:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 094AE42047; Fri, 6 Mar 2020 11:05:50 +0000 (GMT) Received: from pratiks-thinkpad.in.ibm.com (unknown [9.124.31.88]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 6 Mar 2020 11:05:49 +0000 (GMT) From: Pratik Rajesh Sampat To: linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, psampat@linux.ibm.com, pratik.r.sampat@gmail.com, ego@linux.vnet.ibm.com Subject: [PATCH] Fixes: 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling") Date: Fri, 6 Mar 2020 16:35:49 +0530 X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20030611-0016-0000-0000-000002EDBDD4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20030611-0017-0000-0000-00003351157E Message-Id: <20200306110549.25517-1-psampat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-06_03:2020-03-06,2020-03-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003060079 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch avoids allocating cpufreq_policy on stack hence fixing frame size overflow in 'powernv_cpufreq_work_fn' Signed-off-by: Pratik Rajesh Sampat --- 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.17.1