]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 30 Jul 2024 08:41:25 +0000 (10:41 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 6 Aug 2024 08:22:52 +0000 (10:22 +0200)
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>

hw/sd/sdhci.c

index d02c3e3963be0a0e7c28df29d2e4e06bfce78ba3..8293d8355626784365efc8fc54611f405390e1ea 100644 (file)
@@ -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;