Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2401582ybt; Sun, 21 Jun 2020 19:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyygBbYQNPmuuky93Ae7csFHHkGw4X/SfiOVF23HN9LEHKOGdfVbGCpVaZpOFLlP33ydWn+ X-Received: by 2002:a17:906:7e50:: with SMTP id z16mr14432712ejr.277.1592792670348; Sun, 21 Jun 2020 19:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592792670; cv=none; d=google.com; s=arc-20160816; b=h+lS6h07sC8nYVTQ0cHhaidZHSN5w2eDisbgigK8SDf238i51BASGaCxAldPFWNtVO QFiL6V/QjJk0y1SrkkTbufmF+/OI73KnseCsfAebVoBPloYXK9Jg6lK6IzwKGmai6bz6 PL49+4gIK2GpWm3a03WvKlF3ibXL2pCjykTOVYAhXwPC3yh1WDtVxdmz0Hb4l3E+Z/Gf m1vniVFCG5vLvN4ROW0QnuEJc6xXCb6Yzspmtfy7RaGg/6Bgje4QYmi+CoZABQK9dBLo 66M1XkEJ43gpD/kaM4bHTcd4d2Zy4mBg00+DQ4WhGsrkdZ6kJ5PBkfCDEs9hk7yT++Bx Kijw== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=za4ixpkZVJ89aZj99CdaA5henDCAhx0/4oZkooHfKSM=; b=xwFc4wuonZdmL0Su4AD8gfOZejwhap/W/4qsbP4xqXnJlmqv6xQinNXGMZ6AVvMrpd FUeICKuTKNOhXEbHdCALRaHB62suRrKq3ImQ29dgwIbLFIsIN1j3V9KPFzZL5xsjyoYa U8ivMZV5ubPTeMnyIvArHF1xPFKCzbaZBJLkWiwMTI0Sz1zVmmNut1PJXRU4f1FNd51i QMGBwpxZkoV0S5JM9MxTY3hw/6aT2HqOIF/UDib6akmlosuCRN5/09KjIA6JoNMvpHgc xB51f52J2PqIgOzBSPMUEUUpNckl2Z8d2bm/mzpFPkrooP4jsqboga5JGNDSLA7RBJ5I EpBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a5HO9j+w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si7611937ejh.665.2020.06.21.19.24.07; Sun, 21 Jun 2020 19:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a5HO9j+w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731021AbgFVCVl (ORCPT + 99 others); Sun, 21 Jun 2020 22:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726456AbgFVCVk (ORCPT ); Sun, 21 Jun 2020 22:21:40 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DEC0C061794 for ; Sun, 21 Jun 2020 19:21:40 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x207so7731627pfc.5 for ; Sun, 21 Jun 2020 19:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=za4ixpkZVJ89aZj99CdaA5henDCAhx0/4oZkooHfKSM=; b=a5HO9j+w7TlTCzuhw+ErrqrGWVXKa5oUj7qYt5EOEM1bzS3OcwQ608ozcI6NloQw3D bXlHU46+YfEZwUWe0v6V5thX/67joii/re2fHcch1I/WF+f3tUku/ajXoIEVUAz9ZVJS djDjg3RcwiiXutYd+rBdbCPZoI4KUvriIYMhY0Wjx9bRjPzzVGn31NC89ATaNHWPnxY5 i7a6VUynyNHt+KdqK9zVC4kh6Di9rUuSBPO95x+3YAPL3hgw1akVj4sm9Ojzw12C46aQ ego0CXDzdbS8h6O2MMrErvI7X/HGcIAFch1Ic9NiYquTB6xrFsWKTR+49YSUrXUyb2zW aK2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=za4ixpkZVJ89aZj99CdaA5henDCAhx0/4oZkooHfKSM=; b=K4kG+om2opf6CmTrynH601Kdcka+8vEwtb0IaW/HCrlSjKOqNT5fa6xzKyc0xQSOOE fnGqiatVOuky7SCQlltemlJJJN5mk/nDsretukTo30I/rn7cYSgK5xrq+nWePgTEp7xz NptuCGN0pV3mtfthjl+eN7HaNM8LaERuyCoLjBq+/qnHFe8RBbIJlPU9J0hQ4Xzwvri0 3kdtZc4UDtKAYqrW2PbtOg3xQm+bqw46OSZ9FbjwTEK6TwhKDISmKgwD0vuiuvJXnC8Q WMVeA9TSOcSJt92SwIPpb5p6v7QxbqwhkWngR8twQORyp62v2H3k6vRrtzNWhqJvRtio ppnw== X-Gm-Message-State: AOAM533xftqkqroQ56MYhWduQNFVDVbcIJwOkKq1MZH2cKW6Gqw2xYma 8DNcJK56l6ANV/O6qunRfZxa5O0/pmA= X-Received: by 2002:a63:924b:: with SMTP id s11mr10807370pgn.74.1592792499893; Sun, 21 Jun 2020 19:21:39 -0700 (PDT) Received: from localhost ([122.172.111.76]) by smtp.gmail.com with ESMTPSA id i5sm11906183pjd.23.2020.06.21.19.21.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jun 2020 19:21:39 -0700 (PDT) Date: Mon, 22 Jun 2020 07:51:37 +0530 From: Viresh Kumar To: Ivan Kokshaysky Cc: Gregory Clement , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: dt: fix oops on armada37xx Message-ID: <20200622022137.f27ztstb5w3o43fe@vireshk-i7> References: <20200620164449.GA19776@mail.rc.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200620164449.GA19776@mail.rc.ru> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-06-20, 17:44, Ivan Kokshaysky wrote: > Commit 0c868627e617e43a295d8 (cpufreq: dt: Allow platform specific > intermediate callbacks) added two function pointers to the > struct cpufreq_dt_platform_data. However, armada37xx_cpufreq_driver_init() > has this struct (pdata) located on the stack and uses only "suspend" > and "resume" fields. So these newly added "get_intermediate" and > "target_intermediate" pointers are uninitialized and contain arbitrary > non-null values, causing all kinds of trouble. > > For instance, here is an oops on espressobin after an attempt to change > the cpefreq governor: > > [ 29.174554] Unable to handle kernel execute from non-executable memory at virtual address ffff00003f87bdc0 > ... > [ 29.269373] pc : 0xffff00003f87bdc0 > [ 29.272957] lr : __cpufreq_driver_target+0x138/0x580 > ... > > Fixed by zeroing out pdata before use. > > Signed-off-by: Ivan Kokshaysky > --- > drivers/cpufreq/armada-37xx-cpufreq.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c > index aa0f06dec959..df1c941260d1 100644 > --- a/drivers/cpufreq/armada-37xx-cpufreq.c > +++ b/drivers/cpufreq/armada-37xx-cpufreq.c > @@ -456,6 +456,7 @@ static int __init armada37xx_cpufreq_driver_init(void) > /* Now that everything is setup, enable the DVFS at hardware level */ > armada37xx_cpufreq_enable_dvfs(nb_pm_base); > > + memset(&pdata, 0, sizeof(pdata)); > pdata.suspend = armada37xx_cpufreq_suspend; > pdata.resume = armada37xx_cpufreq_resume; Applied. Thanks. -- viresh