[PATCH weston] compositor-drm: Fix crash when setting up seat constrained by an output

Neil Roberts neil at linux.intel.com
Tue Apr 22 10:22:41 PDT 2014


It looks like this patch makes Weston crash on touch events.

The device_added functions in udev-seat.c and libinput-seat.c try to use
the output list in order to assign the output for the newly created
device. These functions get called via udev_input_init so I guess that
means this function and create_outputs now depend on each other making a
chicken and egg situation. If the device_added function can't find an
output for the new device then it defaults to first output in the list.
However since this patch the output list is now empty at that point so
it ends up with a garbage pointer for the output. When the input code
tries to handle an absolute event (eg, a touch event) then it tries to
get the width and height from the current mode of the output for the
device but this is now garbage. For me with libinput this causes it to
segfault whereas without libinput it gets garbage width and height
values and causes a floating point exception later on.

I haven't looked any further to decide what's the best thing to do.

- Neil

Ander Conselvan de Oliveira <conselvan2 at gmail.com> writes:

> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
>
> Commit 58e15865 changed the parameters for udev_get_seat_by_name() to
> receive a struct udev_input. However, when this gets called from
> create_output_from_connector() during initialization, the input struct
> is not yet initialized, leading to a crash. Previously, that function
> would take only a pointer to the compositor.
>
> This patch fixes the crash by initializing input before creating any
> outputs.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=77503


More information about the wayland-devel mailing list