[PATCH xserver] xwayland: Do not assume we have a seat

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 28 01:45:06 UTC 2017


On Mon, Feb 27, 2017 at 03:19:53PM +0100, Olivier Fourdan wrote:
> If a key event is sent programmatically, we may not have an Xwayland
> seat associated with it, in which case we end up crashing in
> keyboard_check_repeat().
> 
> This is the case with "antimicro" which sends key events based on the
> joystick buttons.
> 
> Avoid the NULL pointer dereference by first checking if the xwl_seat is
> non-NULL.
> 
> Bugzilla: https://bugzilla.redhat.com/1416244
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> ---
>  hw/xwayland/xwayland-input.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
> index cc83ef8..8435da0 100644
> --- a/hw/xwayland/xwayland-input.c
> +++ b/hw/xwayland/xwayland-input.c
> @@ -742,10 +742,16 @@ static Bool
>  keyboard_check_repeat (DeviceIntPtr dev, XkbSrvInfoPtr xkbi, unsigned key)
>  {
>      struct xwl_seat *xwl_seat = dev->public.devicePrivate;
> -    struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
> +    struct xwl_screen *xwl_screen;
>      struct wl_callback *callback;
>      struct sync_pending *p;
>  
> +    /* If we do not have an xwl_seat, it's not coming from the compositor */
> +    if (!xwl_seat)
> +      return TRUE;
> +
> +    xwl_screen = xwl_seat->xwl_screen;
> +
>      /* Make sure we didn't miss a possible reply from the compositor */
>      xwl_sync_events (xwl_screen);
>  
> -- 
> 2.9.3

what device is this called for? quick skim of the xwayland sources indicates
that a device is only created if we have a seat, so I wonder ifthe repeat is
called for the wrong device here?

Cheers,
   Peter


More information about the xorg-devel mailing list