summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 02:34:09 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 02:34:09 +0200
commitfb827ec68446c83e9e8754fa9b55aed27ecc4661 (patch)
treee953aedce01fa1c90a8e7b591e40310c3c1e7447 /kernel
parentMerge branch 'delete-mca' of git://git.kernel.org/pub/scm/linux/kernel/git/pa... (diff)
parentGuard check in module loader against integer overflow (diff)
downloadlinux-fb827ec68446c83e9e8754fa9b55aed27ecc4661.tar.xz
linux-fb827ec68446c83e9e8754fa9b55aed27ecc4661.zip
Merge tag 'module-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
Pull module patches from Rusty Russell, who really sells them: "Three trivial patches of no real utility. Modules are boring." But to make things slightly more exciting, he adds: "Fortunately David Howells is looking to change this, with his module signing patchset. But that's for next merge window... Cheers, Rusty." * tag 'module-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: Guard check in module loader against integer overflow modpost: use proper kernel style for autogenerated files modpost: Stop grab_file() from leaking filedescriptors if fstat() fails
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c
index a4e60973ca73..4edbd9c11aca 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2429,7 +2429,8 @@ static int copy_and_check(struct load_info *info,
goto free_hdr;
}
- if (len < hdr->e_shoff + hdr->e_shnum * sizeof(Elf_Shdr)) {
+ if (hdr->e_shoff >= len ||
+ hdr->e_shnum * sizeof(Elf_Shdr) > len - hdr->e_shoff) {
err = -ENOEXEC;
goto free_hdr;
}