summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2023-03-19 22:27:39 +0100
committerLuis Chamberlain <mcgrof@kernel.org>2023-03-24 19:33:06 +0100
commit02da2cbab452a236fa67abc9fc9e47430934e652 (patch)
tree5b2c6542d9eeedc400ebe9ac6ebcf4f0444d3ee5
parentmodule: move early sanity checks into a helper (diff)
downloadlinux-02da2cbab452a236fa67abc9fc9e47430934e652.tar.xz
linux-02da2cbab452a236fa67abc9fc9e47430934e652.zip
module: move check_modinfo() early to early_mod_check()
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. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
-rw-r--r--kernel/module/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 22596cb46dc8..95fd705328ac 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -2273,10 +2273,6 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
unsigned int ndx;
int err;
- err = check_modinfo(info->mod, info, flags);
- if (err)
- return ERR_PTR(err);
-
/* Allow arches to frob section contents and sizes. */
err = module_frob_arch_sections(info->hdr, info->sechdrs,
info->secstrings, info->mod);
@@ -2690,6 +2686,10 @@ static int early_mod_check(struct load_info *info, int flags)
if (!check_modstruct_version(info, info->mod))
return -ENOEXEC;
+ err = check_modinfo(info->mod, info, flags);
+ if (err)
+ return err;
+
return 0;
}