From patchwork Thu Jun 19 18:55:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ball X-Patchwork-Id: 4385751 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11519BEEAA for ; Thu, 19 Jun 2014 18:55:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31C44202AE for ; Thu, 19 Jun 2014 18:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B7832026F for ; Thu, 19 Jun 2014 18:55:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018AbaFSSzL (ORCPT ); Thu, 19 Jun 2014 14:55:11 -0400 Received: from void.printf.net ([89.145.121.20]:38525 "EHLO void.printf.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754891AbaFSSzL (ORCPT ); Thu, 19 Jun 2014 14:55:11 -0400 Received: from chris by void.printf.net with local (Exim 4.69) (envelope-from ) id 1WxhUK-0003eE-EA; Thu, 19 Jun 2014 19:55:08 +0100 From: Chris Ball To: Ulf Hansson 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 Message-ID: <86d2e4n303.fsf@void.printf.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: rucsoftsec@gmail.com Signed-off-by: Chris Ball --- 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);