diff mbox

mmc: test: Fix potential __free_pages(NULL) in mmc_test

Message ID 86d2e4n303.fsf@void.printf.net (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Ball June 19, 2014, 6:55 p.m. UTC
alloc_pages() can return NULL, in which case we'll pass NULL to
__free_pages().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=78391
Reported-by: RUC_SoftSec <rucsoftsec@gmail.com>
Cc: rucsoftsec@gmail.com
Signed-off-by: Chris Ball <chris@printf.net>
---
 drivers/mmc/card/mmc_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 0c0fc52..c86da32 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -2884,7 +2884,8 @@  static ssize_t mtf_test_write(struct file *file, const char __user *buf,
 	}
 
 #ifdef CONFIG_HIGHMEM
-	__free_pages(test->highmem, BUFFER_ORDER);
+	if (test->highmem)
+            __free_pages(test->highmem, BUFFER_ORDER);
 #endif
 	kfree(test->buffer);
 	kfree(test);