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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to