]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/drm-lease-make-sure-implicit-planes-are-leased.patch
4.19-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / drm-lease-make-sure-implicit-planes-are-leased.patch
1 From 204f640da6914844b3270b41b29c84f6e3b74083 Mon Sep 17 00:00:00 2001
2 From: Daniel Vetter <daniel.vetter@ffwll.ch>
3 Date: Thu, 28 Feb 2019 15:49:08 +0100
4 Subject: drm/lease: Make sure implicit planes are leased
5
6 From: Daniel Vetter <daniel.vetter@ffwll.ch>
7
8 commit 204f640da6914844b3270b41b29c84f6e3b74083 upstream.
9
10 If userspace doesn't enable universal planes, then we automatically
11 add the primary and cursor planes. But for universal userspace there's
12 no such check (and maybe we only want to give the lessee one plane,
13 maybe not even the primary one), hence we need to check for the
14 implied plane.
15
16 v2: don't forget setcrtc ioctl.
17
18 v3: Still allow disabling of the crtc in SETCRTC.
19
20 Cc: stable@vger.kernel.org
21 Cc: Keith Packard <keithp@keithp.com>
22 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
23 Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
24 Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-6-daniel.vetter@ffwll.ch
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/gpu/drm/drm_crtc.c | 4 ++++
29 drivers/gpu/drm/drm_plane.c | 8 ++++++++
30 2 files changed, 12 insertions(+)
31
32 --- a/drivers/gpu/drm/drm_crtc.c
33 +++ b/drivers/gpu/drm/drm_crtc.c
34 @@ -595,6 +595,10 @@ int drm_mode_setcrtc(struct drm_device *
35
36 plane = crtc->primary;
37
38 + /* allow disabling with the primary plane leased */
39 + if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id))
40 + return -EACCES;
41 +
42 mutex_lock(&crtc->dev->mode_config.mutex);
43 drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
44 retry:
45 --- a/drivers/gpu/drm/drm_plane.c
46 +++ b/drivers/gpu/drm/drm_plane.c
47 @@ -940,6 +940,11 @@ retry:
48 if (ret)
49 goto out;
50
51 + if (!drm_lease_held(file_priv, crtc->cursor->base.id)) {
52 + ret = -EACCES;
53 + goto out;
54 + }
55 +
56 ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx);
57 goto out;
58 }
59 @@ -1042,6 +1047,9 @@ int drm_mode_page_flip_ioctl(struct drm_
60
61 plane = crtc->primary;
62
63 + if (!drm_lease_held(file_priv, plane->base.id))
64 + return -EACCES;
65 +
66 if (crtc->funcs->page_flip_target) {
67 u32 current_vblank;
68 int r;