summaryrefslogtreecommitdiffstats
path: root/kernel/module/main.c
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2026-03-12 08:25:41 +0100
committerMaxime Ripard <mripard@kernel.org>2026-03-12 08:25:41 +0100
commitf08ceb71c5a5615577e7c841e1e00a89f495ab51 (patch)
treea024ee0aa3a8c5f3da518c7a9e15c6be131dd4f5 /kernel/module/main.c
parentf66d6cc6891e41be96380261943837b1909107b3 (diff)
parent58351f46de26bcc4403f9972f7aed430d15cbd03 (diff)
downloadlinux-f08ceb71c5a5615577e7c841e1e00a89f495ab51.tar.gz
linux-f08ceb71c5a5615577e7c841e1e00a89f495ab51.zip
Merge drm/drm-next into drm-misc-next
Biju Das needs a patch for rz-du merged in 7.0-rc3 Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'kernel/module/main.c')
-rw-r--r--kernel/module/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 2bac4c7cd019..c3ce106c70af 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1568,6 +1568,13 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
break;
default:
+ if (sym[i].st_shndx >= info->hdr->e_shnum) {
+ pr_err("%s: Symbol %s has an invalid section index %u (max %u)\n",
+ mod->name, name, sym[i].st_shndx, info->hdr->e_shnum - 1);
+ ret = -ENOEXEC;
+ break;
+ }
+
/* Divert to percpu allocation if a percpu var. */
if (sym[i].st_shndx == info->index.pcpu)
secbase = (unsigned long)mod_percpu(mod);
@@ -3544,12 +3551,6 @@ static int load_module(struct load_info *info, const char __user *uargs,
mutex_unlock(&module_mutex);
free_module:
mod_stat_bump_invalid(info, flags);
- /* Free lock-classes; relies on the preceding sync_rcu() */
- for_class_mod_mem_type(type, core_data) {
- lockdep_free_key_range(mod->mem[type].base,
- mod->mem[type].size);
- }
-
module_memory_restore_rox(mod);
module_deallocate(mod, info);
free_copy: