Skip to contentSkip to conversation

(for-2.5) Don't allow a guest to crash QEMU

PATCH New Eugene (jno) Dvurechenski 1 participant 2 messages Nov 26, 2015

lore
Share & tools
lore
#0 lore raw

cover (for-2.5) Don't allow a guest to crash QEMU

I've found the case where erratic guest was able to crash QEMU. This patch prevents dereferencing of a NULL pointer (empty 'd' in the assertion, no valid LUN was specified).

Eugene (jno) Dvurechenski (1):
virtio-scsi: don't crash without a valid device

 hw/scsi/virtio-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.3.9
#1 lore raw

PATCH 1/1 (for-2.5) virtio-scsi: don't crash without a valid device

Make sure that we actually have a device when checking the aio context. Otherwise guests could trigger QEMU crashes.

---
 hw/scsi/virtio-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/virtio-scsi.c +1 -1
index 7655401..3a4f520 100644
@@ -250,7 +250,7 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
     int target;
     int ret = 0;
 
-    if (s->dataplane_started) {
+    if (s->dataplane_started && d) {
         assert(blk_get_aio_context(d->conf.blk) == s->ctx);
     }
     /* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE".  */
Signature · 1 line
2.3.9