linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: test: Fix potential __free_pages(NULL) in mmc_test
@ 2014-06-19 18:55 Chris Ball
  0 siblings, 0 replies; only message in thread
From: Chris Ball @ 2014-06-19 18:55 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, rucsoftsec

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 --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);
-- 
Chris Ball   <http://printf.net/>

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-19 18:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19 18:55 [PATCH] mmc: test: Fix potential __free_pages(NULL) in mmc_test Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).