This moves check_modinfo() to early_mod_check(). This doesn't make any functional changes either, as check_modinfo() was the first call on layout_and_allocate(), so we're just moving it back one routine and at the end. This let's us keep separate the checkers from the allocator.
Showing the changes to kernel/module (1 of 1 file). Show all
Unified · Split
| @@ -2273,10 +2273,6 @@ static struct module *layout_and_allocate(struct load_info *info, int flags) · 2272 unmodified lines | ||
| 2273 | 2273 | unsigned int ndx; |
| 2274 | 2274 | int err; |
| 2275 | 2275 | |
| 2276 | − err = check_modinfo(info->mod, info, flags); | |
| 2277 | − if (err) | |
| 2278 | − return ERR_PTR(err); | |
| 2279 | − | |
| 2280 | 2276 | /* Allow arches to frob section contents and sizes. */ |
| 2281 | 2277 | err = module_frob_arch_sections(info->hdr, info->sechdrs, |
| 2282 | 2278 | info->secstrings, info->mod); |
| @@ -2690,6 +2686,10 @@ static int early_mod_check(struct load_info *info, int flags) · 407 unmodified lines | ||
| 2690 | 2686 | if (!check_modstruct_version(info, info->mod)) |
| 2691 | 2687 | return -ENOEXEC; |
| 2692 | 2688 | |
| 2689 | + err = check_modinfo(info->mod, info, flags); | |
| 2690 | + if (err) | |
| 2691 | + return err; | |
| 2692 | + | |
| 2693 | 2693 | return 0; |
| 2694 | 2694 | } |
| 2695 | 2695 | |