lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1316359301-2263-1-git-send-email-linkinjeon@gmail.com>
Date:	Mon, 19 Sep 2011 00:21:41 +0900
From:	Namjae Jeon <linkinjeon@...il.com>
To:	cjb@...top.org, linux-mmc@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, Namjae Jeon <linkinjeon@...il.com>
Subject: [PATCH] mmc : Use wait_for_completion_timeout() instead of wait_for_completion in case of write.

host controller can not rise timeout interrupt in write not read in DMA status. 
because host can just know whether card is finish to program to use busy line. 
If unstable card is keep holding busy line while writing using DMA.
hang problem happen by wait_for_completion. so I think that mmc driver need some exception to avoid this problem.
I suggest to use wait_for_completion_timeout instead of wait_for_completion.

Signed-off-by: Namjae Jeon <linkinjeon@...il.com>
---
 drivers/mmc/core/core.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 557856b..0fe83d3 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -253,7 +253,20 @@ static void __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq)
 static void mmc_wait_for_req_done(struct mmc_host *host,
 				  struct mmc_request *mrq)
 {
-	wait_for_completion(&mrq->completion);
+	unsigned int timeout_us;
+
+	if ((mrq->data != NULL) && (mrq->data->flags & MMC_DATA_WRITE)) {
+		timeout_us = mrq->data->timeout_ns / 1000;
+		if (mmc_host_clk_rate(host))
+			timeout_us += mrq->data->timeout_clks * 1000 /
+				(mmc_host_clk_rate(host) / 1000);
+		if (!timeout_us)
+			timeout_us = 1000000;
+		if (!wait_for_completion_timeout(&mrq->completion,
+				usecs_to_jiffies(timeout_us)))
+			mrq->cmd->error = -ETIMEDOUT;
+	} else
+		wait_for_completion(&mrq->completion);
 }
 
 /**
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ