public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] unbalanced try_get_module/put_module in cpufreq
  2004-04-21 16:47 [PATCH] unbalanced try_get_module/put_module in cpufreq Charles Coffing
@ 2004-04-21 16:05 ` Dave Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2004-04-21 16:05 UTC (permalink / raw)
  To: Charles Coffing; +Cc: linux-kernel, Dominik Brodowski

On Wed, Apr 21, 2004 at 10:47:02AM -0600, Charles Coffing wrote:
 > 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, applied. (Slightly different variant, but same end result).

		Dave


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] unbalanced try_get_module/put_module in cpufreq
@ 2004-04-21 16:47 Charles Coffing
  2004-04-21 16:05 ` Dave Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Coffing @ 2004-04-21 16:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Dominik Brodowski

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;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-21 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-21 16:47 [PATCH] unbalanced try_get_module/put_module in cpufreq Charles Coffing
2004-04-21 16:05 ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox