kernel: fix vmalloc stack traces triggered by module with an empty init section ...
[openwrt/staging/florian.git] / target / linux / generic / patches-3.2 / 340-module_alloc_size_check.patch
1 --- a/kernel/module.c
2 +++ b/kernel/module.c
3 @@ -2286,12 +2286,15 @@
4
5 void * __weak module_alloc(unsigned long size)
6 {
7 - return size == 0 ? NULL : vmalloc_exec(size);
8 + return vmalloc_exec(size);
9 }
10
11 static void *module_alloc_update_bounds(unsigned long size)
12 {
13 - void *ret = module_alloc(size);
14 + void *ret = NULL;
15 +
16 + if (size)
17 + ret = module_alloc(size);
18
19 if (ret) {
20 mutex_lock(&module_mutex);