[Trac #251] Timeout calculation causes divide by zero on stopped SD card.

Zarro Boogs per Child bugtracker at laptop.org
Tue Nov 14 05:12:25 EST 2006


#251: Timeout calculation causes divide by zero on stopped SD card.
--------------------+-------------------------------------------------------
 Reporter:  dwmw2   |        Owner:  dwmw2  
     Type:  defect  |       Status:  new    
 Priority:  normal  |    Milestone:  BTest-1
Component:  kernel  |   Resolution:         
 Keywords:          |  
--------------------+-------------------------------------------------------
Comment (by PierreOssman):

 Proper fix:

 {{{
 diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
 index f9027c8..4af512a 100644
 --- a/drivers/mmc/mmc_block.c
 +++ b/drivers/mmc/mmc_block.c
 @@ -83,7 +83,6 @@ static void mmc_blk_put(struct mmc_blk_d
         md->usage--;
         if (md->usage == 0) {
                 put_disk(md->disk);
 -               mmc_cleanup_queue(&md->queue);
                 kfree(md);
         }
         mutex_unlock(&open_lock);
 @@ -228,7 +227,7 @@ static int mmc_blk_issue_rq(struct mmc_q
         int ret;

         if (mmc_card_claim_host(card))
 -               goto cmd_err;
 +               goto flush_queue;

         do {
                 struct mmc_command cmd;
 @@ -380,6 +379,7 @@ #endif

         mmc_card_release_host(card);

 +flush_queue:
         spin_lock_irq(&md->lock);
         while (ret) {
                 ret = end_that_request_chunk(req, 0,
 @@ -553,12 +553,11 @@ static void mmc_blk_remove(struct mmc_ca
         if (md) {
                 int devidx;

 +               /* Stop new requests from getting into the queue */
                 del_gendisk(md->disk);

 -               /*
 -                * I think this is needed.
 -                */
 -               md->disk->queue = NULL;
 +               /* Then flush out any already in there */
 +               mmc_cleanup_queue(&md->queue);

                 devidx = md->disk->first_minor >> MMC_SHIFT;
                 __clear_bit(devidx, dev_use);
 }}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/251#comment:5>
One Laptop Per Child <http://laptop.org/>



More information about the Bugs mailing list