[PATCH] unbalanced try_get_module/put_module in cpufreq

From: Charles Coffing
Date: Wed Apr 21 2004 - 10:58:04 EST


Hi,

This patch is against 2.6.5. There's a small bug in cpufreq_add_dev: If kmalloc fails, try_get_module() is not balanced by a module_put().

Thanks,
Charles


diff -pu linux-2.6.5.orig/drivers/cpufreq/cpufreq.c linux-2.6.5/drivers/cpufreq/cpufreq.c
--- linux-2.6.5.orig/drivers/cpufreq/cpufreq.c 2004-04-03 20:36:26.000000000 -0700
+++ linux-2.6.5/drivers/cpufreq/cpufreq.c 2004-04-20 12:38:53.110191544 -0600
@@ -361,7 +361,10 @@ static int cpufreq_add_dev (struct sys_d

policy = kmalloc(sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!policy)
+ {
+ module_put(cpufreq_driver->owner);
return -ENOMEM;
+ }
memset(policy, 0, sizeof(struct cpufreq_policy));

policy->cpu = cpu;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/