From patchwork Mon Apr 15 06:24:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 2443771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 5CA1DDF2E5 for ; Mon, 15 Apr 2013 06:25:27 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URcqz-000560-Iy; Mon, 15 Apr 2013 06:25:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1URcqx-0001oT-DU; Mon, 15 Apr 2013 06:25:23 +0000 Received: from mail-pb0-f41.google.com ([209.85.160.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1URcqp-0001na-9G for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2013 06:25:17 +0000 Received: by mail-pb0-f41.google.com with SMTP id mc17so2349359pbc.14 for ; Sun, 14 Apr 2013 23:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=7KoKMGLRpX1sELZlLq5pGJuOvIJ60Ay/Fc7Su7ehejU=; b=JWbLnQD7koq5tiI/wpk9fEOZP6+BqKG62b937NyNslB3PeCZwP/5WaabYEiygqjr3a TmGzepFKcTnJC10cUElripSQ5XklgqI6ZbyU3AD7kPzuLJMHH0u482rRtD65du/fsvVj iwcRivmg5DxImfFtDI93E5cuSAD2WhMhwfLk9fSNZKg71vY5WWh4fWl5IirckThXQPWk mpB9v1XuMgH57f912aFCHf5Sc6Tu0Rm/Fox7KMVOh0GPlrqogY2c4dABc6iqRU9f3DyM JcGwC2LoLR6VoHnhbL5T+30malrxHV51GnQN3EOT5mEhe4FYv/oZ+bdiqQUkA7ktNtb/ oFGA== X-Received: by 10.66.139.226 with SMTP id rb2mr7115083pab.134.1366007113082; Sun, 14 Apr 2013 23:25:13 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id be7sm19183646pad.20.2013.04.14.23.25.07 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 14 Apr 2013 23:25:11 -0700 (PDT) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH] cpufreq: exynos5440: Protect opp search calls with rcu lock Date: Mon, 15 Apr 2013 11:54:47 +0530 Message-Id: <1366007087-12090-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130415_022515_401737_7A3133B5 X-CRM114-Status: GOOD ( 12.64 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.41 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (amitdanielk[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Nishanth Menon , Kukjin Kim , linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org As per the OPP library documentation(Documentation/power/opp.txt) all opp find/get calls should be protected by rcu locks. Signed-off-by: Amit Daniel Kachhap --- This patch is created against linux-next tree and is suggested by Nishanth Menon. (https://lkml.org/lkml/2013/4/12/119) drivers/cpufreq/exynos5440-cpufreq.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index ead7ed4..0c74018 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c @@ -120,11 +120,13 @@ static int init_div_table(void) int i = 0; struct opp *opp; + rcu_read_lock(); for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { opp = opp_find_freq_exact(dvfs_info->dev, freq_tbl[i].frequency * 1000, true); if (IS_ERR(opp)) { + rcu_read_unlock(); dev_err(dvfs_info->dev, "failed to find valid OPP for %u KHZ\n", freq_tbl[i].frequency); @@ -159,6 +161,7 @@ static int init_div_table(void) __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i); } + rcu_read_unlock(); return 0; }