ide_sector_start_dma() starts accounting for reading and writing, and ide_dma_cb() is supposed to complete it, but currently does not always: In one case, it just forgets it altogether, in the other, it uses block_acct_invalid(), which should not be used after a cookie has already been created.
Signed-off-by: Hanna Czenczek <[email protected]> --- hw/ide/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index f78b00220b8..d18adceffc0 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -878,6 +878,7 @@ static void ide_dma_cb(void *opaque, int ret) if (ret == -EINVAL) { ide_dma_error(s); + block_acct_failed(blk_get_stats(s->blk), &s->acct); return; } @@ -944,7 +945,7 @@ static void ide_dma_cb(void *opaque, int ret) if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, n)) { ide_dma_error(s); - block_acct_invalid(blk_get_stats(s->blk), s->acct.type); + block_acct_failed(blk_get_stats(s->blk), &s->acct); return; } -- 2.55.0
