Skip to contentSkip to conversation

Patch "mtd: nand: mxc: Fix mxc_v1 ooblayout" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Sep 10, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

mtd: nand: mxc: Fix mxc_v1 ooblayout

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mtd-nand-mxc-fix-mxc_v1-ooblayout.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 3bff08dffe3115a25ce04b95ea75f6d868572c60 Mon Sep 17 00:00:00 2001

From: Boris Brezillon <[email protected]>
Date: Fri, 25 Nov 2016 11:32:32 +0100
Subject: mtd: nand: mxc: Fix mxc_v1 ooblayout

From: Boris Brezillon <[email protected]>

commit 3bff08dffe3115a25ce04b95ea75f6d868572c60 upstream.

Commit a894cf6c5a82 ("mtd: nand: mxc: switch to mtd_ooblayout_ops") introduced a bug in the OOB layout description. Even if the driver claims that 3 ECC bytes are reserved to protect 512 bytes of data, it's actually 5 ECC bytes to protect 512+6 bytes of data (some OOB bytes are also protected using extra ECC bytes).

Fix the mxc_v1_ooblayout_{free,ecc}() functions to reflect this behavior.

Fixes a894cf6c5a82 ("mtd: nand: mxc: switch to mtd_ooblayout_ops")
---
 drivers/mtd/nand/mxc_nand.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mtd/nand/mxc_nand.c +4 -3
@@ -877,6 +877,8 @@ static void mxc_do_addr_cycle(struct mtd
 	}
 }
 
+#define MXC_V1_ECCBYTES		5
+
 static int mxc_v1_ooblayout_ecc(struct mtd_info *mtd, int section,
 				struct mtd_oob_region *oobregion)
 {
@@ -886,7 +888,7 @@ static int mxc_v1_ooblayout_ecc(struct m
 		return -ERANGE;
 
 	oobregion->offset = (section * 16) + 6;
-	oobregion->length = nand_chip->ecc.bytes;
+	oobregion->length = MXC_V1_ECCBYTES;
 
 	return 0;
 }
@@ -908,8 +910,7 @@ static int mxc_v1_ooblayout_free(struct
 			oobregion->length = 4;
 		}
 	} else {
-		oobregion->offset = ((section - 1) * 16) +
-				    nand_chip->ecc.bytes + 6;
+		oobregion->offset = ((section - 1) * 16) + MXC_V1_ECCBYTES + 6;
 		if (section < nand_chip->ecc.steps)
 			oobregion->length = (section * 16) + 6 -
 					    oobregion->offset;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/mtd-nand-qcom-fix-config-error-for-bch.patch queue-4.12/mtd-nand-hynix-add-support-for-20nm-nand-chips.patch queue-4.12/mtd-nand-mxc-fix-mxc_v1-ooblayout.patch queue-4.12/mtd-nand-make-samsung-slc-nand-usable-again.patch queue-4.12/mtd-nand-qcom-fix-read-failure-without-complete-bootchain.patch