From: Ben Collins Date: Sun, 8 Jan 2006 09:03:04 +0000 (-0800) Subject: [PATCH] Unchecked alloc_percpu() return in __create_workqueue() X-Git-Tag: v2.6.16-rc1~767 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=676121fcb66c861804e38d94214fd5670a1ef595;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 62d47220696..e72fb6478da 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();