[PATCH libinput] udev: fix a race condition if a device disappears before we get a handle

Hans de Goede hdegoede at redhat.com
Wed Feb 18 02:53:10 PST 2015


Hi,

On 18-02-15 04:36, Peter Hutterer wrote:
> If the device disappears too quickly, the device is NULL, the sysname is NULL
> and that causes a segfault in strcmp.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Looks good / simple:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans

> ---
>   src/udev-seat.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/udev-seat.c b/src/udev-seat.c
> index 3d05733..6615f20 100644
> --- a/src/udev-seat.c
> +++ b/src/udev-seat.c
> @@ -158,6 +158,8 @@ udev_input_add_devices(struct udev_input *input, struct udev *udev)
>   	udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
>   		path = udev_list_entry_get_name(entry);
>   		device = udev_device_new_from_syspath(udev, path);
> +		if (!device)
> +			continue;
>
>   		sysname = udev_device_get_sysname(device);
>   		if (strncmp("event", sysname, 5) != 0) {
>


More information about the wayland-devel mailing list