[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/12] hw/i386/vmmouse: Fix crash when using the vmmouse on a mach
From: |
Laurent Vivier |
Subject: |
[PULL 06/12] hw/i386/vmmouse: Fix crash when using the vmmouse on a machine without vmport |
Date: |
Thu, 6 Feb 2020 13:50:21 +0100 |
From: Thomas Huth <address@hidden>
QEMU currently crashes when the user tries to use the "vmmouse" on a
machine without vmport, e.g.:
$ x86_64-softmmu/qemu-system-x86_64 -machine microvm -device vmmouse
Segmentation fault (core dumped)
or:
$ x86_64-softmmu/qemu-system-x86_64 -device vmmouse -M pc,vmport=off
Segmentation fault (core dumped)
Let's avoid the crash by checking for the vmport device first.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
hw/i386/vmmouse.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 7c2a3755271a..e8e62bd96b8c 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "ui/console.h"
#include "hw/i386/pc.h"
#include "hw/input/i8042.h"
@@ -269,6 +270,11 @@ static void vmmouse_realizefn(DeviceState *dev, Error
**errp)
DPRINTF("vmmouse_init\n");
+ if (!object_resolve_path_type("", TYPE_VMPORT, NULL)) {
+ error_setg(errp, "vmmouse needs a machine with vmport");
+ return;
+ }
+
vmport_register(VMMOUSE_STATUS, vmmouse_ioport_read, s);
vmport_register(VMMOUSE_COMMAND, vmmouse_ioport_read, s);
vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s);
--
2.24.1
- [PULL 00/12] Trivial branch patches, Laurent Vivier, 2020/02/06
- [PULL 01/12] hw/smbios/smbios: Remove unused include, Laurent Vivier, 2020/02/06
- [PULL 03/12] MAINTAINERS: update Leif Lindholm's address, Laurent Vivier, 2020/02/06
- [PULL 02/12] monitor: fix memory leak in monitor_fdset_dup_fd_find_remove, Laurent Vivier, 2020/02/06
- [PULL 08/12] qemu-options: replace constant 1 with HAS_ARG, Laurent Vivier, 2020/02/06
- [PULL 07/12] MAINTAINERS: Cover hppa-softmmu.mak in the HP-PARISC Machines section, Laurent Vivier, 2020/02/06
- [PULL 05/12] hw/bt: Remove empty Kconfig file, Laurent Vivier, 2020/02/06
- [PULL 10/12] hw/pci/pci_bridge: Fix typo in comment, Laurent Vivier, 2020/02/06
- [PULL 04/12] hw/timer/m48t59: Convert debug printf()s to trace events, Laurent Vivier, 2020/02/06
- [PULL 09/12] qemu-img: Place the '-i aio' option in alphabetical order, Laurent Vivier, 2020/02/06
- [PULL 06/12] hw/i386/vmmouse: Fix crash when using the vmmouse on a machine without vmport,
Laurent Vivier <=
- [PULL 12/12] MAINTAINERS: Cc the address@hidden for the ARM machines, Laurent Vivier, 2020/02/06
- [PULL 11/12] aspeed/i2c: Prevent uninitialized warning, Laurent Vivier, 2020/02/06
- Re: [PULL 00/12] Trivial branch patches, Peter Maydell, 2020/02/06