OSDN Git Service

Revert "megasas: remove useless check for cmd->frame"
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 8 Sep 2016 15:42:53 +0000 (17:42 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 13 Sep 2016 17:09:43 +0000 (19:09 +0200)
This reverts commit 8cc46787b5b58f01a11c919c7ff939ed009e27fc.
It turns out that cmd->frame can be NULL and thus the commit
can cause a SIGSEGV

Reported-by: Holger Schranz <holger@fam-schranz.de>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/megasas.c

index e968302..52a4123 100644 (file)
@@ -1981,7 +1981,11 @@ static void megasas_handle_frame(MegasasState *s, uint64_t frame_addr,
         break;
     }
     if (frame_status != MFI_STAT_INVALID_STATUS) {
-        cmd->frame->header.cmd_status = frame_status;
+        if (cmd->frame) {
+            cmd->frame->header.cmd_status = frame_status;
+        } else {
+            megasas_frame_set_cmd_status(s, frame_addr, frame_status);
+        }
         megasas_unmap_frame(s, cmd);
         megasas_complete_frame(s, cmd->context);
     }