[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/13] hw/sd/sdhci: Fix DMA Transfer Block Size field
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 03/13] hw/sd/sdhci: Fix DMA Transfer Block Size field |
Date: |
Wed, 21 Oct 2020 19:34:40 +0200 |
The 'Transfer Block Size' field is 12-bit wide.
See section '2.2.2. Block Size Register (Offset 004h)' in datasheet.
Two different bug reproducer available:
- https://bugs.launchpad.net/qemu/+bug/1892960
- https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fsdhci_oob_write1
Cc: qemu-stable@nongnu.org
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Fixes: d7dfca0807a ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20200901140411.112150-3-f4bug@amsat.org>
---
hw/sd/sdhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index ed717ab549b..c849c3d99b8 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1107,7 +1107,7 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val,
unsigned size)
break;
case SDHC_BLKSIZE:
if (!TRANSFERRING_DATA(s->prnsts)) {
- MASKED_WRITE(s->blksize, mask, value);
+ MASKED_WRITE(s->blksize, mask, extract32(value, 0, 12));
MASKED_WRITE(s->blkcnt, mask >> 16, value >> 16);
}
--
2.26.2
- [PULL 00/13] SD/MMC patches for 2020-10-21, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 01/13] hw/sd/sdhci: Fix qemu_log_mask() format string, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 02/13] hw/sd/sdhci: Document the datasheet used, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 03/13] hw/sd/sdhci: Fix DMA Transfer Block Size field,
Philippe Mathieu-Daudé <=
- [PULL 04/13] hw/sd/sdhci: Stop multiple transfers when block count is cleared, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 05/13] hw/sd/sdhci: Resume pending DMA transfers on MMIO accesses, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 06/13] hw/sd/sdhci: Let sdhci_update_irq() return if IRQ was delivered, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 07/13] hw/sd/sdhci: Yield if interrupt delivered during multiple transfer, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 08/13] hw/sd/sdcard: Add trace event for ERASE command (CMD38), Philippe Mathieu-Daudé, 2020/10/21
- [PULL 09/13] hw/sd/sdcard: Introduce the INVALID_ADDRESS definition, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 10/13] hw/sd/sdcard: Do not use legal address '0' for INVALID_ADDRESS, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 11/13] hw/sd/sdcard: Reset both start/end addresses on error, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 12/13] hw/sd/sdcard: Do not attempt to erase out of range addresses, Philippe Mathieu-Daudé, 2020/10/21
- [PULL 13/13] hw/sd/sdcard: Assert if accessing an illegal group, Philippe Mathieu-Daudé, 2020/10/21