[PATCH] Fix infinite loop in INFTL_foldchain() in drivers/mtd/inftlcore.c

From: Daniel Rosenthal
Date: Sun Oct 05 2008 - 18:17:16 EST


Below is a patch to fix an infinite loop in the last loop of
INFTL_foldchain() in drivers/mtd/inftlcore.c modified against Linus'
kernel tree. If INFTL_formatblock() fails repeatedly, this last loop
will go forever because PUtable[thisEUN] is only checked against
BLOCK_NIL and not BLOCK_RESERVED, and if the block fails to format,
PUtable[prevEUN] is not set to BLOCK_NIL.

This will update the in memory copy of the PUchain, but it should be
verified that when the system reboots and the inftl device is
remounted, that the code will properly construct the PUchain from the
device. I do not have the expertise to verify this myself, so perhaps
somebody else should. A couple other people and I will try to take a
look at it over the next couple days, but make no guarantees.

-Daniel


Patch:
--------------------------