aboutsummaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 1395ca382fb..a1d2ed8bab9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -29,6 +29,7 @@
#include <linux/vmalloc.h>
#include <linux/elf.h>
#include <linux/proc_fs.h>
+#include <linux/security.h>
#include <linux/seq_file.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
@@ -2485,10 +2486,16 @@ static int elf_header_check(struct load_info *info)
static int copy_module_from_user(const void __user *umod, unsigned long len,
struct load_info *info)
{
+ int err;
+
info->len = len;
if (info->len < sizeof(*(info->hdr)))
return -ENOEXEC;
+ err = security_kernel_module_from_file(NULL);
+ if (err)
+ return err;
+
/* Suck in entire file: we'll want most of it. */
info->hdr = vmalloc(info->len);
if (!info->hdr)
@@ -2515,6 +2522,10 @@ static int copy_module_from_fd(int fd, struct load_info *info)
if (!file)
return -ENOEXEC;
+ err = security_kernel_module_from_file(file);
+ if (err)
+ goto out;
+
err = vfs_getattr(file->f_vfsmnt, file->f_dentry, &stat);
if (err)
goto out;