Skip to contentSkip to conversation

block/iscsi: fix double-free on BUSY or similar statuses

PATCH New Paolo Bonzini 1 participant 1 message Jan 10, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/iscsi: fix double-free on BUSY or similar statuses

Commit 8c460269aa77 ("iscsi: base all handling of check condition on scsi_sense_to_errno", 2019-07-15) removed a "goto out" so that the same coroutine is re-entered twice; once from iscsi_co_generic_cb, once from the timer callback iscsi_retry_timer_expired. This can cause a crash.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1378

Reported-by Grzegorz Zdanowski <https://gitlab.com/kiler129>
---
 block/iscsi.c | 1 +
 1 file changed, 1 insertion(+)
block/iscsi.c +1 -0
index a316d46d9625..1bba42a71b77 100644
@@ -268,6 +268,7 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
                 timer_mod(&iTask->retry_timer,
                           qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + retry_time);
                 iTask->do_retry = 1;
+                return;
             } else if (status == SCSI_STATUS_CHECK_CONDITION) {
                 int error = iscsi_translate_sense(&task->sense);
                 if (error == EAGAIN) {
Signature · 1 line
2.38.1