Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp4259900ybh; Tue, 17 Mar 2020 15:34:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuTsbElwP2/d25kKCEaYyRv0XQ5jz3gYIYOcwj2CH56MM34v8Gz+Coxv9AQidysbjoH+tji X-Received: by 2002:a9d:12b3:: with SMTP id g48mr1262184otg.269.1584484452980; Tue, 17 Mar 2020 15:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584484452; cv=none; d=google.com; s=arc-20160816; b=OwSFpisR1ckzHv33rBGc0LcS/KLfz5MOD/MxtbtsuMbQbaJsLmbH/LnaiDIehB3Q24 +tnja1j35A4Z6ELEA8W2WmnNzTdT7HbDYH+/NsNAgrhQNo3aEt4bP43mF5+F4lz5shBQ K2WqY74V02Q8CVJgF4lt7sOEUI0MxdHo1iund7ZTu09ZL2VmIqUsibwTEDt+/ZJjYqm0 IS7aU3I14PtFogj7utcvcGhiaHg2tb+OB0q9YtONCDj5T6X0RNzgsaTOQ9i73JSX8Bbp GCq2behcwusvCNSeI11rQrn9UeRmqtdsTA0To9TBP6Tz8pq6SGzm2TN+06sGNJvoWbXt VGkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:to:from:dkim-signature; bh=wPJg6k1Sfn4B+Mn0ckVM+kQDp/J12ZPy70SP4OqLIKc=; b=Uasn8sygcKKoHuXMV7Chrgiw3NABoBWWAeHpqv2TgZuFS/1BTIR9apD49rMf5yfc2s yJU3YiQO1jUTGlIwMw4H7XHPFiOfY8g22ODFumXIbxRc7t9cBtU33wAxsqpnXzDsZgSR zFA80ZX5uQuekutuXjvLjMfLYP+G+z5pe41EId69yAMykt9M14xe5Jh8rkEKHTzefrag BUB5Zqrwl8SlWfupONZoz/vR8tZMNNiJzxBMtR15kf6RDnmELhg4n+nKmOefC9OCxol2 Rr+lCV0yl1COf98zz4s42fRTmRzi8gtwVdIaT2vanNjJPIDtgdZxDbndyexqHCZ2dASp qyGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=a4AYWaPY; 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 m20si2424972otk.238.2020.03.17.15.34.01; Tue, 17 Mar 2020 15:34:12 -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; dkim=pass header.i=@axtens.net header.s=google header.b=a4AYWaPY; 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 S1727233AbgCQWaq (ORCPT + 99 others); Tue, 17 Mar 2020 18:30:46 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38012 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727082AbgCQWap (ORCPT ); Tue, 17 Mar 2020 18:30:45 -0400 Received: by mail-pf1-f194.google.com with SMTP id z5so12750002pfn.5 for ; Tue, 17 Mar 2020 15:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=wPJg6k1Sfn4B+Mn0ckVM+kQDp/J12ZPy70SP4OqLIKc=; b=a4AYWaPYTV1Ov4C4bMzAohMy1SC9tLz+W2ucVsXcKXrISG2pEufjEu65pVsU1Ulzxc SIInJL8CAWvEzvc4bd9aGw48Zr0Q1cHy+J5QxTenCh7Wo/xUBrzI0zUgcp71syQ4Ud38 jykLe4l8oLtY3FBM1DHX2IV9hs8tkHyakVKQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=wPJg6k1Sfn4B+Mn0ckVM+kQDp/J12ZPy70SP4OqLIKc=; b=cTQWFv4RAYXnXhToUe1aHI536iy0C6zOYfChqxITygRV5mfhPWqquLaeN2opKTtWb6 9MjLGsREKBAN8g9SYBZ/OadjF2kmGp5pDXSWlGF5Zop0a4ilXtdhZcAt+bhDvGC0jah6 j3xXN3/mMgsj7axbeltEvUSqRgGV7uFcnGjuRwK/0P9o4xrYA50ADp77AvEY4NUmeK6g owNHYENgt8MyrP8xUNVUDl6OCEii3M8HU4e8sUUsuVyeFxi0SLcAjFke1J2Wf5ZL6cEA c6bvldTYKmHGSGtz3KmrjMFbgjy81O/mACoSNr6cMY8J4lruS+An4Z0qPxBP6NXUh0iU rQQQ== X-Gm-Message-State: ANhLgQ2olCsddae7NeFaNb4l1iZwBU7T5xa/B/MsVbur4YZIzWaVrhmS RoE0pUABubEf4XNWjdmmTyPDgg== X-Received: by 2002:a63:741c:: with SMTP id p28mr1255502pgc.402.1584484243489; Tue, 17 Mar 2020 15:30:43 -0700 (PDT) Received: from localhost (2001-44b8-111e-5c00-11e1-e7cb-3c10-05d6.static.ipv6.internode.on.net. [2001:44b8:111e:5c00:11e1:e7cb:3c10:5d6]) by smtp.gmail.com with ESMTPSA id a2sm348002pjq.20.2020.03.17.15.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 15:30:42 -0700 (PDT) From: Daniel Axtens To: Pratik Rajesh Sampat , 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: Re: [PATCH] cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn In-Reply-To: <20200316135743.57735-1-psampat@linux.ibm.com> References: <20200316135743.57735-1-psampat@linux.ibm.com> Date: Wed, 18 Mar 2020 09:30:39 +1100 Message-ID: <87fte6obqo.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pratik, Thanks. I have checked: - for matching puts/gets - that all the '.' to '->' conversions, aud uses of '&' check out - that the Snowpatch checks pass (https://patchwork.ozlabs.org/patch/1255580/) On that basis: Reviewed-by: Daniel Axtens Regards, Daniel > 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 > --- > 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