diff --git a/kernel/module.c b/kernel/module.c index 256b3c80a771..ef79f4dbda87 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3029,6 +3029,10 @@ static int elf_validity_check(struct load_info *info) * strings in the section safe. */ info->secstrings = (void *)info->hdr + strhdr->sh_offset; + if (strhdr->sh_size == 0) { + pr_err("empty section name table\n"); + goto no_exec; + } if (info->secstrings[strhdr->sh_size - 1] != '\0') { pr_err("ELF Spec violation: section name table isn't null terminated\n"); goto no_exec;