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]
Date:	Wed, 12 Dec 2007 13:18:28 -0500
From:	Dave Jones <davej@...hat.com>
To:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	"Rafael J. Wysocki" <rjw@...k.pl>, venkatesh.pallipadi@...el.com
Subject: Re: [crash] kernel BUG at drivers/cpufreq/cpufreq.c:1060!

On Wed, Dec 12, 2007 at 11:40:13AM -0500, Dave Jones wrote:
 
 >  > powernow-k8: Found 1 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ processors (1 cpu cores) (version 2.20.00)
 >  > powernow-k8: BIOS error - no PSB or ACPI _PSS objects
 >  > ------------[ cut here ]------------
 >  > kernel BUG at drivers/cpufreq/cpufreq.c:1060!
 > 
 > The actual BUG you hit is 
 > 
 >         if (unlikely(lock_policy_rwsem_write(cpu)))
 >                 BUG();
 > 
 > It _looks_ like we're leaking a refcount on that lock, but
 > I don't see where.  It's a shame you can't reproduce this easily,
 > as cpufreq.debug=7 would give us more clues.
 > (And CONFIG_CPUFREQ_DEBUG=y)

So we're missing some unlocks in some error paths.
It's feasible you hit one of those.
This patch should be the fix for that.

	Dave

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5e626b1..79581fa 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -841,19 +841,25 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
 	drv_attr = cpufreq_driver->attr;
 	while ((drv_attr) && (*drv_attr)) {
 		ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
-		if (ret)
+		if (ret) {
+			unlock_policy_rwsem_write(cpu);
 			goto err_out_driver_exit;
+		}
 		drv_attr++;
 	}
 	if (cpufreq_driver->get){
 		ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
-		if (ret)
+		if (ret) {
+			unlock_policy_rwsem_write(cpu);
 			goto err_out_driver_exit;
+		}
 	}
 	if (cpufreq_driver->target){
 		ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
-		if (ret)
+		if (ret) {
+			unlock_policy_rwsem_write(cpu);
 			goto err_out_driver_exit;
+		}
 	}
 
 	spin_lock_irqsave(&cpufreq_driver_lock, flags);
-- 
http://www.codemonkey.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ