aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/kernel/module.c b/kernel/module.c
index fb404299082e..54623c714bba 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1572,7 +1572,6 @@ static struct module *load_module(void __user *umod,
1572 exportindex, modindex, obsparmindex, infoindex, gplindex, 1572 exportindex, modindex, obsparmindex, infoindex, gplindex,
1573 crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex, 1573 crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex,
1574 gplfuturecrcindex; 1574 gplfuturecrcindex;
1575 long arglen;
1576 struct module *mod; 1575 struct module *mod;
1577 long err = 0; 1576 long err = 0;
1578 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ 1577 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -1691,23 +1690,11 @@ static struct module *load_module(void __user *umod,
1691 } 1690 }
1692 1691
1693 /* Now copy in args */ 1692 /* Now copy in args */
1694 arglen = strlen_user(uargs); 1693 args = strndup_user(uargs, ~0UL >> 1);
1695 if (!arglen) { 1694 if (IS_ERR(args)) {
1696 err = -EFAULT; 1695 err = PTR_ERR(args);
1697 goto free_hdr;
1698 }
1699 args = kmalloc(arglen, GFP_KERNEL);
1700 if (!args) {
1701 err = -ENOMEM;
1702 goto free_hdr; 1696 goto free_hdr;
1703 } 1697 }
1704 if (copy_from_user(args, uargs, arglen) != 0) {
1705 err = -EFAULT;
1706 goto free_mod;
1707 }
1708
1709 /* Userspace could have altered the string after the strlen_user() */
1710 args[arglen - 1] = '\0';
1711 1698
1712 if (find_module(mod->name)) { 1699 if (find_module(mod->name)) {
1713 err = -EEXIST; 1700 err = -EEXIST;