kernel: update linux 3.6 to 3.6.8
[openwrt.git] / target / linux / generic / patches-3.6 / 340-module_alloc_size_check.patch
1 --- a/kernel/module.c
2 +++ b/kernel/module.c
3 @@ -2358,12 +2358,15 @@ static void dynamic_debug_remove(struct
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);