]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
module: do not print allocation-fail warning on bogus user buffer size
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 24 Mar 2015 02:01:40 +0000 (12:31 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 24 Mar 2015 02:02:37 +0000 (12:32 +1030)
init_module(2) passes user-specified buffer length directly to
vmalloc(). It makes warn_alloc_failed() to print out a lot of info into
dmesg if user specified insane size, like -1.

Let's silence the warning. It doesn't add much value to -ENOMEM return
code. Without the patch the syscall is prohibitive noisy for testing
with trinity.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/module.c

index 3ab942f78760cf6ad6529aeac0c109e6c17fc296..65bd206e04a9d585041f3e915eed8926e4d4d67a 100644 (file)
@@ -2494,7 +2494,8 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
                return err;
 
        /* Suck in entire file: we'll want most of it. */
-       info->hdr = vmalloc(info->len);
+       info->hdr = __vmalloc(info->len,
+                       GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, PAGE_KERNEL);
        if (!info->hdr)
                return -ENOMEM;