]> git.proxmox.com Git - mirror_qemu.git/commitdiff
esp: ensure that async_len is reset to 0 during esp_hard_reset()
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Thu, 18 Nov 2021 10:03:26 +0000 (10:03 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Nov 2021 09:14:30 +0000 (10:14 +0100)
If a reset command is sent after data has been transferred into the SCSI buffer
ensure that async_len is reset to 0. Otherwise a subsequent TI command assumes
the SCSI buffer contains data to be transferred to the device causing it to
dereference the stale async_buf pointer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/724
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211118100327.29061-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/esp.c

index 84f935b549aa324b21001857cc9fe22ea9fb502d..58d0edbd56d7f9b989d221637b05ce9f0b2c65f4 100644 (file)
@@ -894,6 +894,7 @@ void esp_hard_reset(ESPState *s)
     memset(s->wregs, 0, ESP_REGS);
     s->tchi_written = 0;
     s->ti_size = 0;
+    s->async_len = 0;
     fifo8_reset(&s->fifo);
     fifo8_reset(&s->cmdfifo);
     s->dma = 0;