[PATCH libinput] evdev: fail before open_restricted if the devnode doesn't exist

Peter Hutterer peter.hutterer at who-t.net
Tue Feb 13 03:43:27 UTC 2018


Checking these bugs before I was about to push:

On Fri, Feb 09, 2018 at 07:59:08PM +1000, Peter Hutterer wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1536633
> https://bugzilla.redhat.com/show_bug.cgi?id=1539046
> https://bugzilla.redhat.com/show_bug.cgi?id=1539783
> https://bugzilla.redhat.com/show_bug.cgi?id=1540662
> https://bugs.freedesktop.org/show_bug.cgi?id=104278
 
afaict, these should all fixed by cbb4ec1e3e76b64ec53c25036976e0374aaf41de.
Did you actually have a case of a null path? 

Cheers,
   Peter

> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Can you give this one a try please? Quick fix but it passes the test suite.
> 
>  src/evdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index d1ca243d..d412eeb0 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1917,6 +1917,11 @@ evdev_device_create(struct libinput_seat *seat,
>  	const char *devnode = udev_device_get_devnode(udev_device);
>  	const char *sysname = udev_device_get_sysname(udev_device);
>  
> +	if (!devnode) {
> +		log_info(libinput, "%s: no device node associated\n", sysname);
> +		return NULL;
> +	}
> +
>  	if (udev_device_should_be_ignored(udev_device)) {
>  		log_debug(libinput, "%s: device is ignored\n", sysname);
>  		return NULL;
> @@ -2434,6 +2439,9 @@ evdev_device_resume(struct evdev_device *device)
>  		return -ENODEV;
>  
>  	devnode = udev_device_get_devnode(device->udev_device);
> +	if (devnode == NULL)
> +		return -ENODEV;
> +
>  	fd = open_restricted(libinput, devnode,
>  			     O_RDWR | O_NONBLOCK | O_CLOEXEC);
>  
> -- 
> 2.14.3
> 


More information about the wayland-devel mailing list