aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-30 10:41:25 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2024-08-28 08:37:14 +0300
commitacbef0528b0d60534bd2675743c03c385d277dd7 (patch)
treedf2304fab783a2d7d38e2bcd11fa16a34fffd887
parent3854679d584cfd38ce636668ff06d8edd1127c54 (diff)
hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers
We neglected to clear the @data_count index on ADMA error, allowing to trigger assertion in sdhci_read_dataport() or sdhci_write_dataport(). Cc: qemu-stable@nongnu.org Fixes: d7dfca0807 ("hw/sdhci: introduce standard SD host controller") Reported-by: Zheyu Ma <zheyuma97@gmail.com> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2455 Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240730092138.32443-4-philmd@linaro.org> (cherry picked from commit ed5a159c3de48a581f46de4c8c02b4b295e6c52d) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--hw/sd/sdhci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index e95ea34895..8bfdcf6854 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -846,6 +846,7 @@ static void sdhci_do_adma(SDHCIState *s)
}
}
if (res != MEMTX_OK) {
+ s->data_count = 0;
if (s->errintstsen & SDHC_EISEN_ADMAERR) {
trace_sdhci_error("Set ADMA error flag");
s->errintsts |= SDHC_EIS_ADMAERR;