[PATCH] mmc: test: Fix potential __free_pages(NULL) in mmc_test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Cc: rucsoftsec@xxxxxxxxx
Signed-off-by: Chris Ball <chris@xxxxxxxxxx>
---
 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/>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux