drivers/misc/lkdtm.c: fix missing allocation failure check
authorAlan Cox <alan@linux.intel.com>
Mon, 30 Jul 2012 21:43:24 +0000 (14:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 31 Jul 2012 00:25:22 +0000 (17:25 -0700)
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=44691

Reported-by: <rucsoftsec@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/misc/lkdtm.c

index 28adefe70f96274c93198ee50acc9ee65adec1ae..08aad69c8da4e3f4d8572d52eadd46c00bb65941 100644 (file)
@@ -477,6 +477,8 @@ static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf,
        int i, n, out;
 
        buf = (char *)__get_free_page(GFP_KERNEL);
+       if (buf == NULL)
+               return -ENOMEM;
 
        n = snprintf(buf, PAGE_SIZE, "Available crash types:\n");
        for (i = 0; i < ARRAY_SIZE(cp_type); i++)