Until now, writing to the SENSE or CDB size register would terminate the QEMU 
process,
but a guest should never be able to crash the host process. This patch replaces 
that
behavior with virtio_error() and marks the device as in error, allowing QEMU to 
continue running.This follows the same pattern as other vhost devices.

Signed-off-by: Razvan Ghiorghe <[email protected]>
---
 hw/scsi/vhost-scsi-common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c
index 0bb4305de6..938e9d9965 100644
--- a/hw/scsi/vhost-scsi-common.c
+++ b/hw/scsi/vhost-scsi-common.c
@@ -140,9 +140,9 @@ void vhost_scsi_common_set_config(VirtIODevice *vdev, const 
uint8_t *config)
 
     if ((uint32_t)virtio_ldl_p(vdev, &scsiconf->sense_size) != vs->sense_size 
||
         (uint32_t)virtio_ldl_p(vdev, &scsiconf->cdb_size) != vs->cdb_size) {
-        error_report("vhost-scsi does not support changing the sense data and "
-                     "CDB sizes");
-        exit(1);
+        virtio_error(vdev, "vhost-scsi does not support changing the sense "
+                     "data and CDB sizes");
+        return;
     }
 }
 
-- 
2.43.0


Reply via email to