|
|
edecca |
From c2afbedc310ac1a65a5ee96c8fa4103e926483c4 Mon Sep 17 00:00:00 2001
|
|
|
edecca |
Message-Id: <c2afbedc310ac1a65a5ee96c8fa4103e926483c4@dist-git>
|
|
|
edecca |
From: Han Han <hhan@redhat.com>
|
|
|
edecca |
Date: Tue, 28 Aug 2018 10:30:51 +0200
|
|
|
edecca |
Subject: [PATCH] conf: Add validation of input devices
|
|
|
edecca |
MIME-Version: 1.0
|
|
|
edecca |
Content-Type: text/plain; charset=UTF-8
|
|
|
edecca |
Content-Transfer-Encoding: 8bit
|
|
|
edecca |
|
|
|
edecca |
https://bugzilla.redhat.com/show_bug.cgi?id=1591151
|
|
|
edecca |
|
|
|
edecca |
Add function virDomainInputDefValidate to validate input devices.
|
|
|
edecca |
Make sure evdev attribute of source element is not used by mouse,
|
|
|
edecca |
keyboard, and tablet input device.
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Han Han <hhan@redhat.com>
|
|
|
edecca |
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
|
|
edecca |
(cherry picked from commit deb057fd364cb57614c6dea7b05c247231f9ae4f)
|
|
|
edecca |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
edecca |
|
|
|
edecca |
https: //bugzilla.redhat.com/show_bug.cgi?id=1591240
|
|
|
edecca |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
edecca |
---
|
|
|
edecca |
src/conf/domain_conf.c | 27 ++++++++++++++++++++++++++-
|
|
|
edecca |
1 file changed, 26 insertions(+), 1 deletion(-)
|
|
|
edecca |
|
|
|
edecca |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
edecca |
index 51a79ad8b1..16e52d149d 100644
|
|
|
edecca |
--- a/src/conf/domain_conf.c
|
|
|
edecca |
+++ b/src/conf/domain_conf.c
|
|
|
edecca |
@@ -5760,6 +5760,29 @@ virDomainVsockDefValidate(const virDomainVsockDef *vsock)
|
|
|
edecca |
return 0;
|
|
|
edecca |
}
|
|
|
edecca |
|
|
|
edecca |
+static int
|
|
|
edecca |
+virDomainInputDefValidate(const virDomainInputDef *input)
|
|
|
edecca |
+{
|
|
|
edecca |
+ switch ((virDomainInputType) input->type) {
|
|
|
edecca |
+ case VIR_DOMAIN_INPUT_TYPE_MOUSE:
|
|
|
edecca |
+ case VIR_DOMAIN_INPUT_TYPE_TABLET:
|
|
|
edecca |
+ case VIR_DOMAIN_INPUT_TYPE_KBD:
|
|
|
edecca |
+ case VIR_DOMAIN_INPUT_TYPE_LAST:
|
|
|
edecca |
+ if (input->source.evdev) {
|
|
|
edecca |
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
edecca |
+ _("setting source evdev path only supported for "
|
|
|
edecca |
+ "passthrough input devices"));
|
|
|
edecca |
+ return -1;
|
|
|
edecca |
+ }
|
|
|
edecca |
+ break;
|
|
|
edecca |
+
|
|
|
edecca |
+ case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
|
|
|
edecca |
+ break;
|
|
|
edecca |
+ }
|
|
|
edecca |
+
|
|
|
edecca |
+ return 0;
|
|
|
edecca |
+}
|
|
|
edecca |
+
|
|
|
edecca |
|
|
|
edecca |
static int
|
|
|
edecca |
virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
|
|
edecca |
@@ -5799,9 +5822,11 @@ virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_VSOCK:
|
|
|
edecca |
return virDomainVsockDefValidate(dev->data.vsock);
|
|
|
edecca |
|
|
|
edecca |
+ case VIR_DOMAIN_DEVICE_INPUT:
|
|
|
edecca |
+ return virDomainInputDefValidate(dev->data.input);
|
|
|
edecca |
+
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_LEASE:
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_FS:
|
|
|
edecca |
- case VIR_DOMAIN_DEVICE_INPUT:
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_SOUND:
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
|
|
edecca |
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
|
|
edecca |
--
|
|
|
edecca |
2.18.0
|
|
|
edecca |
|