Commit d027951d authored by Wentao Liang's avatar Wentao Liang Committed by Miquel Raynal
Browse files

mtd: inftlcore: Add error check for inftl_read_oob()



In INFTL_findwriteunit(), the return value of inftl_read_oob()
need to be checked. A proper implementation can be
found in INFTL_deleteblock(). The status will be set as
SECTOR_IGNORE to break from the while-loop correctly
if the inftl_read_oob() fails.

Fixes: 8593fbc6 ("[MTD] Rework the out of band handling completely")
Cc: stable@vger.kernel.org # v2.6+
Signed-off-by: default avatarWentao Liang <vulab@iscas.ac.cn>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 36c64687
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -482,9 +482,10 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
		silly = MAX_LOOPS;

		while (thisEUN <= inftl->lastEUN) {
			inftl_read_oob(mtd, (thisEUN * inftl->EraseSize) +
				       blockofs, 8, &retlen, (char *)&bci);

			if (inftl_read_oob(mtd, (thisEUN * inftl->EraseSize) +
				       blockofs, 8, &retlen, (char *)&bci) < 0)
				status = SECTOR_IGNORE;
			else
				status = bci.Status | bci.Status1;
			pr_debug("INFTL: status of block %d in EUN %d is %x\n",
					block , writeEUN, status);