From patchwork Tue Feb 25 09:48:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 3714321 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3235B9F2F7 for ; Tue, 25 Feb 2014 09:54:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B281201BA for ; Tue, 25 Feb 2014 09:54:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 844FD2018E for ; Tue, 25 Feb 2014 09:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752493AbaBYJyf (ORCPT ); Tue, 25 Feb 2014 04:54:35 -0500 Received: from mail-pb0-f50.google.com ([209.85.160.50]:45555 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752318AbaBYJye (ORCPT ); Tue, 25 Feb 2014 04:54:34 -0500 Received: by mail-pb0-f50.google.com with SMTP id rq2so7917942pbb.9 for ; Tue, 25 Feb 2014 01:54:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Nh1Fcl6yY25VnXKK3HAczFENy4DNsTdoFZckULjRaGo=; b=mKkfOGuHRW4NVOY2e6rmCG0XBMgfWZhZPVutjnBbfX6g1vX06x/0aUE+i4Mtz/gExr ywHWBD6DNXI65m36GxOSWeWH0lj2cFX8OPyMH78VSxWJOIz+VAZkRHOj+NRfuyAq2Ud0 +siBr3IE1LJWI50KuTG2yLHofnYgj+WFGOxvJ2Ekk5eovnS+tzyLXyFqpD54v+wT2X/G 5Epz19d1O7vQS7GU4Z8q11LDgTOO+o4sjEEsgcS9vvQrQx0q0+viUkn8naZdO9ZxdGbw C3VCWUdT+GU6EgVpk4XOEeQvbXU5hxiJ9NUixz8iwZRjEIWEn8GW1YpOdCkQcpUHThQc hS4Q== X-Gm-Message-State: ALoCoQlEXlC1iV2nte7pN4ygQXiIFjshtjzC7aiDB3owio5eGTcgkUQH4GQMFaRVrAkGkm31H5n4 X-Received: by 10.68.239.70 with SMTP id vq6mr5351208pbc.152.1393322074306; Tue, 25 Feb 2014 01:54:34 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id qq5sm8804447pbb.24.2014.02.25.01.54.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:54:33 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, chris@printf.net, sachin.kamat@linaro.org Subject: [PATCH 10/10] mmc: dw_mmc: Fix NULL pointer dereference Date: Tue, 25 Feb 2014 15:18:28 +0530 Message-Id: <1393321708-9719-10-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> References: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> 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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 If mrq->sbc is not NULL but data->stop happens to be NULL, it will lead to NULL pointer dereferencing. Avoid this by having a NULL check for data->stop. Signed-off-by: Sachin Kamat Acked-by: Seungwon Jeon --- drivers/mmc/host/dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 55cd110a49c4..0c56faa6730e 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1345,7 +1345,7 @@ static void dw_mci_tasklet_func(unsigned long priv) if (!err) { if (!data->stop || mrq->sbc) { - if (mrq->sbc) + if (mrq->sbc && data->stop) data->stop->error = 0; dw_mci_request_end(host, mrq); goto unlock;