All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ball <chris@printf.net>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, rucsoftsec@gmail.com
Subject: [PATCH] mmc: test: Fix potential __free_pages(NULL) in mmc_test
Date: Thu, 19 Jun 2014 19:55:08 +0100	[thread overview]
Message-ID: <86d2e4n303.fsf@void.printf.net> (raw)

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/>

                 reply	other threads:[~2014-06-19 18:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86d2e4n303.fsf@void.printf.net \
    --to=chris@printf.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rucsoftsec@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.