lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452533760-13787-15-git-send-email-juri.lelli@arm.com>
Date:	Mon, 11 Jan 2016 17:35:55 +0000
From:	Juri Lelli <juri.lelli@....com>
To:	linux-kernel@...r.kernel.org
Cc:	linux-pm@...r.kernel.org, peterz@...radead.org, rjw@...ysocki.net,
	viresh.kumar@...aro.org, mturquette@...libre.com,
	steve.muckle@...aro.org, vincent.guittot@...aro.org,
	morten.rasmussen@....com, dietmar.eggemann@....com,
	juri.lelli@....com
Subject: [RFC PATCH 14/19] cpufreq: fix locking of policy->rwsem in cpufreq_offline_finish

There are paths in cpufreq_offline_prepare where policy is used, but its
rwsem is not held.

Fix it.

Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Viresh Kumar <viresh.kumar@...aro.org>
Signed-off-by: Juri Lelli <juri.lelli@....com>
---
 drivers/cpufreq/cpufreq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 91158b0..ba452c3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1381,9 +1381,13 @@ static void cpufreq_offline_finish(unsigned int cpu)
 		return;
 	}
 
+	down_write(&policy->rwsem);
+
 	/* Only proceed for inactive policies */
-	if (!policy_is_inactive(policy))
+	if (!policy_is_inactive(policy)) {
+		up_write(&policy->rwsem);
 		return;
+	}
 
 	/* If cpu is last user of policy, free policy */
 	if (has_target()) {
@@ -1392,6 +1396,8 @@ static void cpufreq_offline_finish(unsigned int cpu)
 			pr_err("%s: Failed to exit governor\n", __func__);
 	}
 
+	up_write(&policy->rwsem);
+
 	/*
 	 * Perform the ->exit() even during light-weight tear-down,
 	 * since this is a core component, and is essential for the
-- 
2.2.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ