Skip to contentSkip to conversation

ide: fix halted IO segfault at reset

PATCH RESEND Superseded John Snow 2 participants 3 messages Jul 27, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

John Snow

author
#0 lore raw

cover ide: fix halted IO segfault at reset

Resending for qemu-stable, fixing commit message in the process. Patch is identical to the version tagged for-2.7.

________________________________________________________________________________

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch ide-reset-segfault
https://github.com/jnsnow/qemu/tree/ide-reset-segfault

This version is tagged ide-reset-segfault-v1:
https://github.com/jnsnow/qemu/releases/tag/ide-reset-segfault-v1

John Snow (1):
ide: fix halted IO segfault at reset

 hw/ide/core.c | 1 +
 1 file changed, 1 insertion(+)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH RESEND 1/1 ide: fix halted IO segfault at reset

If one attempts to perform a system_reset after a failed IO request that causes the VM to enter a paused state, QEMU will segfault trying to free up the pending IO requests.

These requests have already been completed and freed, though, so all we need to do is NULL them before we enter the paused state.

Existing AHCI tests verify that halted requests are still resumed successfully after a STOP event.

---
 hw/ide/core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ide/core.c +1 -0
index 081c9eb..d117b7c 100644
@@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret)
     }
     if (ret < 0) {
         if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) {
+            s->bus->dma->aiocb = NULL;
             return;
         }
     }
Signature · 1 line
2.7.4
#2 lore raw
Quoted 21 lines · John Snow

If one attempts to perform a system_reset after a failed IO request that causes the VM to enter a paused state, QEMU will segfault trying to free up the pending IO requests.

These requests have already been completed and freed, though, so all we need to do is NULL them before we enter the paused state.

Existing AHCI tests verify that halted requests are still resumed successfully after a STOP event.

---
 hw/ide/core.c | 1 +
 1 file changed, 1 insertion(+)
hw/ide/core.c +0 -0
index 081c9eb..d117b7c 100644

hw/ide/core.c static void ide_dma_cb(void *opaque, int ret) · line 829

Quoted 7 lines
hw/ide/core.c +1 -0
@@ -823,6 +823,7 @@ static void ide_dma_cb(void *opaque, int ret)
     }
     if (ret < 0) {
         if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) {
+            s->bus->dma->aiocb = NULL;
             return;
         }
     }

You forgot your S-o-b from the end of the commit message, and also my R-b from round #1. Looks like my un-orthodox Analyzed-by distracted you too much! ;)

Care to resend once more with those two tags added?

Thanks!
Laszlo