[Mesa-stable] [Mesa-dev] [PATCH] egl/wayland: bail out when drmGetMagic fails
Eric Engestrom
eric.engestrom at intel.com
Fri Nov 23 20:20:01 UTC 2018
On Friday, 2018-11-23 12:59:52 +0000, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> Currently as the function fails, we pass uninitialized data to the
> authentication function. Stop doing that and print an warning when
> the function fails.
>
> Cc: mesa-stable at lists.freedesktop.org
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/egl/drivers/dri2/platform_wayland.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index cda6f25a7e0..f2dc26d5850 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1134,7 +1134,10 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device)
> if (drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER) {
> dri2_dpy->authenticated = true;
> } else {
> - drmGetMagic(dri2_dpy->fd, &magic);
> + if (drmGetMagic(dri2_dpy->fd, &magic)) {
> + _eglLog(_EGL_WARNING, "wayland-egl: drmGetMagic failed");
> + return;
> + }
This looked familiar... turns out I sent this exact patch a couple years
ago, but never got around to addressing your comments :P
https://patchwork.freedesktop.org/patch/98132/
Anyway, with the close(fd) and free(device_name) you mentioned, this is:
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
(While at it, free(device_name) is also missing from the `if (fd == -1)`
branch.)
> wl_drm_authenticate(dri2_dpy->wl_drm, magic);
> }
> }
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list