public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.15-rc2] Unchecked alloc_percpu() return in __create_workqueue()
@ 2005-11-21 17:35 Ben Collins
  0 siblings, 0 replies; only message in thread
From: Ben Collins @ 2005-11-21 17:35 UTC (permalink / raw)
  To: linux-kernel

[UBUNTU:kernel/workqueue] __create_workqueue() not checking return of alloc_percpu()
    
NULL dereference was possible.
    
Signed-off-by: Ben Collins <bcollins@ubuntu.com>

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -315,6 +315,11 @@ struct workqueue_struct *__create_workqu
 		return NULL;
 
 	wq->cpu_wq = alloc_percpu(struct cpu_workqueue_struct);
+	if (!wq->cpu_wq) {
+		kfree(wq);
+		return NULL;
+	}
+
 	wq->name = name;
 	/* We don't need the distraction of CPUs appearing and vanishing. */
 	lock_cpu_hotplug();

-- 
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-21 18:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-21 17:35 [PATCH 2.6.15-rc2] Unchecked alloc_percpu() return in __create_workqueue() Ben Collins

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