Skip to content

Commit

Permalink
[PATCH] Unchecked alloc_percpu() return in __create_workqueue()
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Ben Collins authored and Linus Torvalds committed Jan 9, 2006
1 parent 9fa37fd commit 676121f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 676121f

Please sign in to comment.