]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Apr 2023 18:39:04 +0000 (20:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Apr 2023 18:39:04 +0000 (20:39 +0200)
added patches:
mtdblock-tolerate-corrected-bit-flips.patch

queue-4.14/mtdblock-tolerate-corrected-bit-flips.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/mtdblock-tolerate-corrected-bit-flips.patch b/queue-4.14/mtdblock-tolerate-corrected-bit-flips.patch
new file mode 100644 (file)
index 0000000..07dbe38
--- /dev/null
@@ -0,0 +1,58 @@
+From 0c3089601f064d80b3838eceb711fcac04bceaad Mon Sep 17 00:00:00 2001
+From: Bang Li <libang.linuxer@gmail.com>
+Date: Wed, 29 Mar 2023 00:30:12 +0800
+Subject: mtdblock: tolerate corrected bit-flips
+
+From: Bang Li <libang.linuxer@gmail.com>
+
+commit 0c3089601f064d80b3838eceb711fcac04bceaad upstream.
+
+mtd_read() may return -EUCLEAN in case of corrected bit-flips.This
+particular condition should not be treated like an error.
+
+Signed-off-by: Bang Li <libang.linuxer@gmail.com>
+Fixes: e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()")
+Cc: <stable@vger.kernel.org> # v3.7
+Acked-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20230328163012.4264-1-libang.linuxer@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/mtdblock.c |   12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/mtd/mtdblock.c
++++ b/drivers/mtd/mtdblock.c
+@@ -185,7 +185,7 @@ static int do_cached_write (struct mtdbl
+                               mtdblk->cache_state = STATE_EMPTY;
+                               ret = mtd_read(mtd, sect_start, sect_size,
+                                              &retlen, mtdblk->cache_data);
+-                              if (ret)
++                              if (ret && !mtd_is_bitflip(ret))
+                                       return ret;
+                               if (retlen != sect_size)
+                                       return -EIO;
+@@ -220,8 +220,12 @@ static int do_cached_read (struct mtdblk
+       pr_debug("mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n",
+                       mtd->name, pos, len);
+-      if (!sect_size)
+-              return mtd_read(mtd, pos, len, &retlen, buf);
++      if (!sect_size) {
++              ret = mtd_read(mtd, pos, len, &retlen, buf);
++              if (ret && !mtd_is_bitflip(ret))
++                      return ret;
++              return 0;
++      }
+       while (len > 0) {
+               unsigned long sect_start = (pos/sect_size)*sect_size;
+@@ -241,7 +245,7 @@ static int do_cached_read (struct mtdblk
+                       memcpy (buf, mtdblk->cache_data + offset, size);
+               } else {
+                       ret = mtd_read(mtd, pos, size, &retlen, buf);
+-                      if (ret)
++                      if (ret && !mtd_is_bitflip(ret))
+                               return ret;
+                       if (retlen != size)
+                               return -EIO;
index 5e7cddb839b8feeb31bcb660cf47795deb4506dd..80c051bb2e065a9c231091b4e62d94e96ba6431e 100644 (file)
@@ -20,3 +20,4 @@ alsa-i2c-cs8427-fix-iec958-mixer-control-deactivation.patch
 alsa-hda-sigmatel-fix-s-pdif-out-on-intel-d-45-motherboards.patch
 bluetooth-l2cap-fix-use-after-free-in-l2cap_disconnect_-req-rsp.patch
 bluetooth-fix-race-condition-in-hidp_session_thread.patch
+mtdblock-tolerate-corrected-bit-flips.patch