All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trey Ramsay <tramsay@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: cjb@laptop.org
Subject: drivers/mmc/card/block.c infinite loop in mmc_blk_err_check waiting on R1_READY_FOR_DATA
Date: Wed, 31 Oct 2012 14:36:23 -0500	[thread overview]
Message-ID: <50917DB7.6040503@linux.vnet.ibm.com> (raw)

In the 3.7-rc3 kernel, there is an infinite loop in the 
mmc_blk_err_check() function in drivers/mmc/card/block.c that can be 
caused bad hardware. This loop has moved around a little, but appears to 
have been around in the kernel since v2.6.12.  The code will loop 
forever on write if the card isn't ready for data or if it's in program 
mode.  I did some searching and saw that it was reported to 
linux-mmc@vger.kernel.org 
http://permalink.gmane.org/gmane.linux.kernel.mmc/2021 back in May but 
didn't see a response.  Should there be a maximum retry count or a 
timeout to prevent an infinite loop?


1030         /*
1031          * Everything else is either success, or a data error of some
1032          * kind.  If it was a write, we may have transitioned to
1033          * program mode, which we have to wait for it to complete.
1034          */
1035         if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
1036                 u32 status;
1037                 do {
1038                         int err = get_card_status(card, &status, 5);
1039                         if (err) {
1040 
                                 pr_err("%s: error %d requesting status\n",
1041                                        req->rq_disk->disk_name, err);
1042                                 return MMC_BLK_CMD_ERR;
1043                         }
1044                         /*
1045                          * Some cards mishandle the status bits,
1046                          * so make sure to check both the busy
1047                          * indication and the card state.
1048                          */
1049                 } while (!(status & R1_READY_FOR_DATA) ||
1050                          (R1_CURRENT_STATE(status) == R1_STATE_PRG));
1051         }


             reply	other threads:[~2012-10-31 19:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 19:36 Trey Ramsay [this message]
2012-10-31 20:47 ` drivers/mmc/card/block.c infinite loop in mmc_blk_err_check waiting on R1_READY_FOR_DATA Chris Ball
     [not found]   ` <50A2A08D.5000601@linux.vnet.ibm.com>
2012-11-13 20:48     ` Chris Ball
2012-11-16 15:31       ` [PATCH 1/1] mmc: Bad device can cause mmc driver to hang Trey Ramsay
2012-11-16 15:31         ` Trey Ramsay
2012-11-16 15:37         ` Chris Ball
2012-11-16 15:37           ` Chris Ball
2012-11-16 23:52           ` Trey Ramsay
2012-11-17  0:37             ` Chris Ball
2012-11-17  5:16               ` Trey Ramsay
2012-11-17  0:40           ` Trey Ramsay
2012-11-17 14:34         ` Chris Ball
2012-11-17 14:34           ` Chris Ball

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=50917DB7.6040503@linux.vnet.ibm.com \
    --to=tramsay@linux.vnet.ibm.com \
    --cc=cjb@laptop.org \
    --cc=linux-kernel@vger.kernel.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.