From patchwork Tue Dec 16 00:50:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5498941 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 88DBBBEEA8 for ; Tue, 16 Dec 2014 00:51:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3C4E2099F for ; Tue, 16 Dec 2014 00:51:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7F2620993 for ; Tue, 16 Dec 2014 00:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752723AbaLPAuy (ORCPT ); Mon, 15 Dec 2014 19:50:54 -0500 Received: from mail-ig0-f172.google.com ([209.85.213.172]:62574 "EHLO mail-ig0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbaLPAuv (ORCPT ); Mon, 15 Dec 2014 19:50:51 -0500 Received: by mail-ig0-f172.google.com with SMTP id hl2so6025954igb.5 for ; Mon, 15 Dec 2014 16:50:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=i7WSX1oRTwBxfK1+u7oxB/+fXlj7rDXgz+xWwZzDsfE=; b=hCD/kishPOTxB9WBGrC4EQuSQK7eTSfm/e035A6F3kqGhT55LYUNESPOgfeaYpjTW3 aHnQULYSkAXIx/ohdJmNwiXpzFGalVqcffSdcO6qt9PwapZbutD3jz44DWkBX0F3WRF9 VJjOo6hVFTKT1Bv4yjPvtZDAcUR9U1N7ACMlSROS/x3A4ux7CPgr8uCGFPcbof3zK3xo gVZz/fM88RgbGXgfZTtT7Hn3IqfFckNxt8OQMihccGVph6C3K8IZ1IVNl4AcP0aAPPxK 1Kv9RSvZcFzloCbmcj49mvu3ujfXpcrb9WpUQa26p4Nl5UBmhIpXRwoSKdhXN5/iLa7j bPww== X-Gm-Message-State: ALoCoQnjhIRmdhv9jlUbRKnrRbSg0vTDyrgswSfgTZ/8H471KrfxZxE55F4Rt4Fj5907Yu3YAs4C X-Received: by 10.50.103.67 with SMTP id fu3mr62711igb.7.1418691051277; Mon, 15 Dec 2014 16:50:51 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:edc3:4b7a:3f05:ce06]) by mx.google.com with ESMTPSA id j82sm5477987iod.12.2014.12.15.16.50.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 15 Dec 2014 16:50:50 -0800 (PST) Date: Mon, 15 Dec 2014 16:50:48 -0800 From: Dmitry Torokhov To: "Rafael J. Wysocki" Cc: Viresh Kumar , Shawn Guo , Philipp Zabel , Anson Huang , John Tobias , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: imx6: prorect calls to dev_pm_opp_get_opp_count with RCU lock Message-ID: <20141216005048.GA3802@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dev_pm_opp_get_opp_count() must be called with RCU lock held. Signed-off-by: Dmitry Torokhov --- Not tested at all... drivers/cpufreq/imx6q-cpufreq.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 380a90d..851d4fd 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -200,7 +200,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) * Just, incase the platform did not supply the OPP * table, it will try to get it. */ + rcu_read_lock(); num = dev_pm_opp_get_opp_count(cpu_dev); + rcu_read_unlock(); if (num < 0) { ret = of_init_opp_table(cpu_dev); if (ret < 0) { @@ -211,7 +213,9 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) /* Because we have added the OPPs here, we must free them */ free_opp = true; + rcu_read_lock(); num = dev_pm_opp_get_opp_count(cpu_dev); + rcu_read_unlock(); if (num < 0) { ret = num; dev_err(cpu_dev, "no OPP table is found: %d\n", ret);