summaryrefslogtreecommitdiffstats
path: root/patches
diff options
context:
space:
mode:
authorRobert Schwebel <r.schwebel@pengutronix.de>2017-09-29 17:34:49 +0200
committerRobert Schwebel <r.schwebel@pengutronix.de>2017-09-29 17:36:59 +0200
commit1328c60f80221b06ca519cd7945f08d6fffc29c1 (patch)
tree8e687f5d2feda0d55861360c50ffb20621f388d5 /patches
parent9de84a9e8653b9f72180af6b8f16f52c469c08a1 (diff)
downloadDistroKit-1328c60f80221b06ca519cd7945f08d6fffc29c1.tar.gz
DistroKit-1328c60f80221b06ca519cd7945f08d6fffc29c1.tar.xz
host-qemu: add patch to fix mmc error messages
Michael Olbrich recently found a bug with mmc handling in QEmu. The patch is already on its way into the upstream. Put it into the BSP until it has hit QEmu mainline. Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'patches')
-rw-r--r--patches/qemu-2.9.0/0001-hw-sd-fix-out-of-bounds-check-for-multi-block-reads.diff48
-rw-r--r--patches/qemu-2.9.0/series1
2 files changed, 49 insertions, 0 deletions
diff --git a/patches/qemu-2.9.0/0001-hw-sd-fix-out-of-bounds-check-for-multi-block-reads.diff b/patches/qemu-2.9.0/0001-hw-sd-fix-out-of-bounds-check-for-multi-block-reads.diff
new file mode 100644
index 0000000..a1514ad
--- /dev/null
+++ b/patches/qemu-2.9.0/0001-hw-sd-fix-out-of-bounds-check-for-multi-block-reads.diff
@@ -0,0 +1,48 @@
+hw/sd: fix out-of-bounds check for multi block reads
+
+The current code checks if the next block exceeds the size of the card.
+This generates an error while reading the last block of the card.
+Do the out-of-bounds check when starting to read a new block to fix this.
+
+This issue became visible with increased error checking in Linux 4.13.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ hw/sd/sd.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/hw/sd/sd.c b/hw/sd/sd.c
+index ba47bff4db80..35347a5bbcde 100644
+--- a/hw/sd/sd.c
++++ b/hw/sd/sd.c
+@@ -1797,8 +1797,13 @@ uint8_t sd_read_data(SDState *sd)
+ break;
+
+ case 18: /* CMD18: READ_MULTIPLE_BLOCK */
+- if (sd->data_offset == 0)
++ if (sd->data_offset == 0) {
++ if (sd->data_start + io_len > sd->size) {
++ sd->card_status |= ADDRESS_ERROR;
++ return 0x00;
++ }
+ BLK_READ_BLOCK(sd->data_start, io_len);
++ }
+ ret = sd->data[sd->data_offset ++];
+
+ if (sd->data_offset >= io_len) {
+@@ -1812,11 +1817,6 @@ uint8_t sd_read_data(SDState *sd)
+ break;
+ }
+ }
+-
+- if (sd->data_start + io_len > sd->size) {
+- sd->card_status |= ADDRESS_ERROR;
+- break;
+- }
+ }
+ break;
+
+--
+2.14.2
+
+
diff --git a/patches/qemu-2.9.0/series b/patches/qemu-2.9.0/series
new file mode 100644
index 0000000..ba8788f
--- /dev/null
+++ b/patches/qemu-2.9.0/series
@@ -0,0 +1 @@
+0001-hw-sd-fix-out-of-bounds-check-for-multi-block-reads.diff