diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index 6dc6a44f4e..611360e6b4 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g, if (!res->image) { g_critical("%s: resource creation failed %d %d %d", __func__, c2d.resource_id, c2d.width, c2d.height); - g_free(res); vugbm_buffer_destroy(&res->buffer); + g_free(res); cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY; return; } diff --git a/hw/display/vga.c b/hw/display/vga.c index 28a90e30d0..9d1f66af40 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -752,7 +752,8 @@ void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) val == VBE_DISPI_ID1 || val == VBE_DISPI_ID2 || val == VBE_DISPI_ID3 || - val == VBE_DISPI_ID4) { + val == VBE_DISPI_ID4 || + val == VBE_DISPI_ID5) { s->vbe_regs[s->vbe_index] = val; } break; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 4d549377cb..e183f4ecda 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -610,12 +610,6 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g, struct virtio_gpu_scanout *scanout; uint8_t *data; - if (scanout_id >= g->parent_obj.conf.max_outputs) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d", - __func__, scanout_id); - *error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; - return; - } scanout = &g->parent_obj.scanout[scanout_id]; if (r->x > fb->width || @@ -694,6 +688,13 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id, ss.r.width, ss.r.height, ss.r.x, ss.r.y); + if (ss.scanout_id >= g->parent_obj.conf.max_outputs) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d", + __func__, ss.scanout_id); + cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; + return; + } + if (ss.resource_id == 0) { virtio_gpu_disable_scanout(g, ss.scanout_id); return; @@ -730,6 +731,13 @@ static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, ss.r.width, ss.r.height, ss.r.x, ss.r.y); + if (ss.scanout_id >= g->parent_obj.conf.max_outputs) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d", + __func__, ss.scanout_id); + cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; + return; + } + if (ss.resource_id == 0) { virtio_gpu_disable_scanout(g, ss.scanout_id); return;