staging: vchiq_2835_arm: Handle vmalloc_to_page error case
authorStefan Wahren <stefan.wahren@i2se.com>
Thu, 25 May 2017 22:26:17 +0000 (00:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 May 2017 15:02:30 +0000 (17:02 +0200)
In case vmalloc_to_page returns NULL create_pagelist must abort
imediatly.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c

index 8911e86..eeeee1b 100644 (file)
@@ -459,6 +459,11 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
                                                                 PAGE_SIZE));
                        size_t bytes = PAGE_SIZE - off;
 
+                       if (!pg) {
+                               cleanup_pagelistinfo(pagelistinfo);
+                               return NULL;
+                       }
+
                        if (bytes > length)
                                bytes = length;
                        pages[actual_pages] = pg;