Skip to content

Commit 74d83be

Browse files
computersforpeaceDavid Woodhouse
authored andcommitted
JFFS2: don't fail on bitflips in OOB
JFFS2 was designed without thought for OOB bitflips, it seems, but they can occur and will be reported to JFFS2 via mtd_read_oob()[1]. We don't want to fail on these transactions, since the data was corrected. [1] Few drivers report bitflips for OOB-only transactions. With such drivers, this patch should have no effect. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 6f12f59 commit 74d83be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/jffs2/wbuf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,10 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
10441044
ops.datbuf = NULL;
10451045

10461046
ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
1047-
if (ret || ops.oobretlen != ops.ooblen) {
1047+
if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
10481048
pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
10491049
jeb->offset, ops.ooblen, ops.oobretlen, ret);
1050-
if (!ret)
1050+
if (!ret || mtd_is_bitflip(ret))
10511051
ret = -EIO;
10521052
return ret;
10531053
}
@@ -1086,10 +1086,10 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
10861086
ops.datbuf = NULL;
10871087

10881088
ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
1089-
if (ret || ops.oobretlen != ops.ooblen) {
1089+
if ((ret && !mtd_is_bitflip(ret)) || ops.oobretlen != ops.ooblen) {
10901090
pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
10911091
jeb->offset, ops.ooblen, ops.oobretlen, ret);
1092-
if (!ret)
1092+
if (!ret || mtd_is_bitflip(ret))
10931093
ret = -EIO;
10941094
return ret;
10951095
}

0 commit comments

Comments
 (0)