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: firefly_0821_release~39503 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=676121fcb66c861804e38d94214fd5670a1ef595;p=firefly-linux-kernel-4.4.55.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 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();