summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Collins <bcollins@debian.org>2006-01-08 01:03:04 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-08 20:13:54 -0800
commit676121fcb66c861804e38d94214fd5670a1ef595 (patch)
tree7b0f9d34efd5e1cb9b6b595aedcd9419942b5055
parent9fa37fd1627ec804e57ae0388555719b03b39f20 (diff)
downloadlinux-676121fcb66c861804e38d94214fd5670a1ef595.tar.bz2
[PATCH] Unchecked alloc_percpu() return in __create_workqueue()
__create_workqueue() not checking return of alloc_percpu() NULL dereference was possible. Signed-off-by: Ben Collins <bcollins@ubuntu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/workqueue.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 62d47220696a..e72fb6478da6 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -315,6 +315,11 @@ struct workqueue_struct *__create_workqueue(const char *name,
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();