Skip to content

Commit bc1171a

Browse files
committed
module: move early sanity checks into a helper
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.40.1.el9_4 commit-author Luis Chamberlain <mcgrof@kernel.org> commit 85e6f61 Empty-Commit: Cherry-Pick Conflicts during history rebuild. Will be included in final tarball splat. Ref for failed cherry-pick at: ciq/ciq_backports/kernel-5.14.0-427.40.1.el9_4/85e6f61c.failed Move early sanity checkers for the module into a helper. This let's us make it clear when we are working with the local copy of the module prior to allocation. This produces no functional changes, it just makes subsequent changes easier to read. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> (cherry picked from commit 85e6f61) Signed-off-by: Jonathan Maple <jmaple@ciq.com> # Conflicts: # kernel/module.c
1 parent 106593c commit bc1171a

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
module: move early sanity checks into a helper
2+
3+
jira LE-1907
4+
Rebuild_History Non-Buildable kernel-5.14.0-427.40.1.el9_4
5+
commit-author Luis Chamberlain <mcgrof@kernel.org>
6+
commit 85e6f61c134f111232d27d3f63667c1bccbbc12d
7+
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
8+
Will be included in final tarball splat. Ref for failed cherry-pick at:
9+
ciq/ciq_backports/kernel-5.14.0-427.40.1.el9_4/85e6f61c.failed
10+
11+
Move early sanity checkers for the module into a helper.
12+
This let's us make it clear when we are working with the
13+
local copy of the module prior to allocation.
14+
15+
This produces no functional changes, it just makes subsequent
16+
changes easier to read.
17+
18+
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
19+
(cherry picked from commit 85e6f61c134f111232d27d3f63667c1bccbbc12d)
20+
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
21+
22+
# Conflicts:
23+
# kernel/module.c
24+
diff --cc kernel/module.c
25+
index 90ad015c6fb5,22596cb46dc8..000000000000
26+
--- a/kernel/module.c
27+
+++ b/kernel/module.c
28+
@@@ -3938,7 -2668,30 +3938,34 @@@ static int unknown_module_param_cb(cha
29+
return 0;
30+
}
31+
32+
++<<<<<<< HEAD:kernel/module.c
33+
+static void cfi_init(struct module *mod);
34+
++=======
35+
+ /* Module within temporary copy, this doesn't do any allocation */
36+
+ static int early_mod_check(struct load_info *info, int flags)
37+
+ {
38+
+ int err;
39+
+
40+
+ /*
41+
+ * Now that we know we have the correct module name, check
42+
+ * if it's blacklisted.
43+
+ */
44+
+ if (blacklisted(info->name)) {
45+
+ pr_err("Module %s is blacklisted\n", info->name);
46+
+ return -EPERM;
47+
+ }
48+
+
49+
+ err = rewrite_section_headers(info, flags);
50+
+ if (err)
51+
+ return err;
52+
+
53+
+ /* Check module struct version now, before we try to use module. */
54+
+ if (!check_modstruct_version(info, info->mod))
55+
+ return -ENOEXEC;
56+
+
57+
+ return 0;
58+
+ }
59+
++>>>>>>> 85e6f61c134f (module: move early sanity checks into a helper):kernel/module/main.c
60+
61+
/*
62+
* Allocate and load the module: note that size of section 0 is always
63+
@@@ -3985,22 -2736,7 +4012,26 @@@ static int load_module(struct load_inf
64+
if (err)
65+
goto free_copy;
66+
67+
++<<<<<<< HEAD:kernel/module.c
68+
+ /*
69+
+ * Now that we know we have the correct module name, check
70+
+ * if it's blacklisted.
71+
+ */
72+
+ if (blacklisted(info->name)) {
73+
+ err = -EPERM;
74+
+ pr_err("Module %s is blacklisted\n", info->name);
75+
+ goto free_copy;
76+
+ }
77+
+
78+
+#ifdef CONFIG_RHEL_DIFFERENCES
79+
+ if (get_modinfo(info, "intree"))
80+
+ module_rh_check_status(info->name);
81+
+#endif
82+
+
83+
+ err = rewrite_section_headers(info, flags);
84+
++=======
85+
+ err = early_mod_check(info, flags);
86+
++>>>>>>> 85e6f61c134f (module: move early sanity checks into a helper):kernel/module/main.c
87+
if (err)
88+
goto free_copy;
89+
90+
* Unmerged path kernel/module.c

0 commit comments

Comments
 (0)