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 <[email protected]> --- 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 _______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
