From patchwork Wed Jul 13 08:02:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 970782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6D81xv8018074 for ; Wed, 13 Jul 2011 08:01:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964994Ab1GMIB7 (ORCPT ); Wed, 13 Jul 2011 04:01:59 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:61453 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964961Ab1GMIB6 (ORCPT ); Wed, 13 Jul 2011 04:01:58 -0400 Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LO9003KDIAQ7NE0@mailout4.samsung.com> for linux-mmc@vger.kernel.org; Wed, 13 Jul 2011 17:01:57 +0900 (KST) X-AuditID: cbfee61b-b7bfdae000006d51-39-4e1d50f4f9df Received: from epmmp1 ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 66.82.27985.4F05D1E4; Wed, 13 Jul 2011 17:01:57 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LO9009NTIB8YU@mmp1.samsung.com> for linux-mmc@vger.kernel.org; Wed, 13 Jul 2011 17:01:56 +0900 (KST) Received: from [165.213.219.108] ([165.213.219.108]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Wed, 13 Jul 2011 17:02:06 +0900 Date: Wed, 13 Jul 2011 17:02:16 +0900 From: Jaehoon Chung Subject: [PATCH] mmc: block: fixed NULL pointer dereference To: "linux-mmc@vger.kernel.org" Cc: Chris Ball , Kyungmin Park , Per Forlin , Philip Rakity Message-id: <4E1D5108.8040309@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Thunderbird 2.0.0.24 (X11/20100623) X-OriginalArrivalTime: 13 Jul 2011 08:02:07.0000 (UTC) FILETIME=[28C46980:01CC4133] X-Brightmail-Tracker: AAAAAA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 13 Jul 2011 08:01:59 +0000 (UTC) Hi. I send to mailing for [RFC] Kernel NULL pointer dereference. This patch is fixed it. In similar case, when discard request, check condition and performed mmc_blk_issue_rw_rq(mq, NULL) for ongoing async transfer. But When flush request, entered the mmc_blk_issue_flush() then return. (then didn't complete ongoing aync transfer). I think that need to complete for ongoing aync transfer before flush request. I tested with this patch, it's working fine. (SDHCI controller, eMMC4.41) Signed-off-by: Jaehoon Chung Signed-off-by: Kyungmin Park Acked-by: Per Forlin --- drivers/mmc/card/block.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 38d0149..1ff5486 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1200,6 +1200,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) else ret = mmc_blk_issue_discard_rq(mq, req); } else if (req && req->cmd_flags & REQ_FLUSH) { + /* complete ongoing async transfer before issuing flush */ + if (card->host->areq) + mmc_blk_issue_rw_rq(mq, NULL); ret = mmc_blk_issue_flush(mq, req); } else { ret = mmc_blk_issue_rw_rq(mq, req);