[PATCH] dix: die if we can't activate or init the VCP/VCK.
Peter Hutterer
peter.hutterer at who-t.net
Tue Feb 3 16:30:45 PST 2009
If we have a busted xkb setup, the XKB initialization on the core devices
fails and leaves us with dev->key->xkbInfo == NULL. This in turn causes
segfaults lateron.
Return BadValue when the XKB configuration for a master device failed, and if
that happens for the VCP/VCK, die semi-gracefully.
Reported by Aaron Plattner.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/devices.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dix/devices.c b/dix/devices.c
index 6578229..1c3a0de 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -488,8 +488,13 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
switch (what) {
case DEVICE_INIT:
XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
- CoreKeyboardCtl);
+ if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
+ CoreKeyboardCtl))
+ {
+ ErrorF("Keyboard initialization failed. This could be a missing "
+ "or incorrect setup of xkeyboard-config.\n");
+ return BadValue;
+ }
return Success;
case DEVICE_ON:
@@ -554,11 +559,12 @@ InitCoreDevices(void)
&inputInfo.keyboard) != Success)
FatalError("Failed to allocate core devices");
- ActivateDevice(inputInfo.pointer);
- ActivateDevice(inputInfo.keyboard);
- EnableDevice(inputInfo.pointer);
- EnableDevice(inputInfo.keyboard);
-
+ if (ActivateDevice(inputInfo.pointer) != Success ||
+ ActivateDevice(inputInfo.keyboard) != Success)
+ FatalError("Failed to activate core devices.");
+ if (!EnableDevice(inputInfo.pointer) ||
+ !EnableDevice(inputInfo.keyboard))
+ FatalError("Failed to enable core devices.");
}
/**
--
1.6.0.6
More information about the xorg
mailing list