Commit Graph

14 Commits

Author SHA1 Message Date
Kenny Levinsen 0cb091f1a2 drm-lease-v1: Free the wlr_drm_lease_v1 on error 2024-02-22 00:41:06 +01:00
Alexander Orzechowski 1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Simon Zeni 60ca6f17eb types/wlr_drm_lease_v1: downgrade DRM backend error message to debug
Downgrades the error message printed out when no DRM backend is given from `WLR_ERROR` to
`WLR_DEBUG`
2023-07-27 22:14:46 -04:00
Simon Ser 5b0719b17c drm-lease-v1: reject the lease request by default
If the compositor didn't call wlr_drm_lease_request_v1_grant() nor
wlr_drm_lease_request_v1_reject(), then reject the lease.
2022-10-07 19:49:28 +00:00
Simon Ser 11d073ab09 drm-lease-v1: send finished event on failure in submit request
If the "submit" request handler fails, send a "finished" event
so that the client doesn't stall forever.
2022-10-07 19:49:28 +00:00
Simon Ser 5c382f6344 drm-lease-v1: fix error codepath
We were crashing in the error codepath [1] when
wlr_drm_create_lease() fails.

To fix this, delay the creation of the wlr_drm_lease_v1 until the
request is granted. Previously we were allocating that struct early
without populating the drm_lease field. However that means we ended
up with a half-constructed struct in the error codepath which is
annoying to handle.

[1]: https://github.com/swaywm/sway/issues/7204#issuecomment-1269797356
2022-10-07 19:49:28 +00:00
John Lindgren 1facdeabe5 wlr_drm_lease_v1: Fix use-after-free in backend_destroy()
valgrind said (on exit from labwc):

    Invalid write of size 8
       at 0x487DEAF: wl_list_remove (wayland-util.c:56)
       by 0x487DF80: wl_signal_emit_mutable (wayland-server.c:2182)
       by 0x48CD6B7: backend_destroy.part.0.lto_priv.0 (backend.c:41)
       by 0x48DC19D: multi_backend_destroy (backend.c:58)
       by 0x4880286: UnknownInlinedFun (wayland-server.c:2315)
       by 0x4880286: wl_display_destroy (wayland-server.c:1170)
       by 0x112491: UnknownInlinedFun (server.c:485)
       by 0x112491: main (main.c:110)
     Address 0x1f9d0210 is 112 bytes inside a block of size 136 free'd
       at 0x484426F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x487DF6D: wl_signal_emit_mutable (wayland-server.c:2179)
       by 0x48CD6B7: backend_destroy.part.0.lto_priv.0 (backend.c:41)
       by 0x48DC19D: multi_backend_destroy (backend.c:58)
       by 0x4880286: UnknownInlinedFun (wayland-server.c:2315)
       by 0x4880286: wl_display_destroy (wayland-server.c:1170)
       by 0x112491: UnknownInlinedFun (server.c:485)
       by 0x112491: main (main.c:110)
     Block was alloc'd at
       at 0x4846A73: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x4918D4E: drm_lease_device_v1_create (wlr_drm_lease_v1.c:639)
       by 0x48D3B00: wlr_multi_for_each_backend (backend.c:249)
       by 0x49191D2: wlr_drm_lease_v1_manager_create (wlr_drm_lease_v1.c:706)
       by 0x111EE9: UnknownInlinedFun (server.c:384)
       by 0x111EE9: main (main.c:92)
2022-09-15 21:24:05 -04:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Simon Ser 410c08cdc6 drm-lease-v1: skip device on wlr_drm_backend_get_non_master_fd failure
On some setups, wlr_drm_backend_get_non_master_fd may fail because
of permission issues. Instead of exposing a bogus global, bail out.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3391
2022-05-02 15:44:16 +00:00
Simon Ser 4377b55292 util/global: remove wl_display arg from wlr_global_destroy_safe
Since [1], we can get the wl_display directly from the wl_global.

[1]: 2b22160fb6
2021-12-14 13:13:50 +00:00
Simon Zeni dd84c5a1cc types/wlr_drm_lease_v1: add NULL check to drm lease resource destroy 2021-11-30 19:59:55 +00:00
Simon Ser 6bb8973309 drm-lease-v1: listen to lease destroy event 2021-11-19 16:06:07 +00:00
Simon Ser 86f5ecf468 backend/drm: introduce wlr_drm_lease
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3183
2021-11-19 16:06:07 +00:00
Simon Zeni 3984c81faa types: introduce wlr_drm_lease_v1 2021-09-08 11:09:07 +02:00