module-alloc-size-check.patch 524 B

123456789101112131415161718192021
  1. https://dev.openwrt.org/browser/trunk/target/linux/generic/patches-3.3/340-module_alloc_size_check.patch?rev=30813
  2. --- a/kernel/module.c
  3. +++ b/kernel/module.c
  4. @@ -2322,12 +2322,15 @@
  5. void * __weak module_alloc(unsigned long size)
  6. {
  7. - return size == 0 ? NULL : vmalloc_exec(size);
  8. + return vmalloc_exec(size);
  9. }
  10. static void *module_alloc_update_bounds(unsigned long size)
  11. {
  12. - void *ret = module_alloc(size);
  13. + void *ret = NULL;
  14. +
  15. + if (size)
  16. + ret = module_alloc(size);
  17. if (ret) {
  18. mutex_lock(&module_mutex);