]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - 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
CommitLineData
091fe26a
GKH
1From 204f640da6914844b3270b41b29c84f6e3b74083 Mon Sep 17 00:00:00 2001
2From: Daniel Vetter <daniel.vetter@ffwll.ch>
3Date: Thu, 28 Feb 2019 15:49:08 +0100
4Subject: drm/lease: Make sure implicit planes are leased
5
6From: Daniel Vetter <daniel.vetter@ffwll.ch>
7
8commit 204f640da6914844b3270b41b29c84f6e3b74083 upstream.
9
10If userspace doesn't enable universal planes, then we automatically
11add the primary and cursor planes. But for universal userspace there's
12no such check (and maybe we only want to give the lessee one plane,
13maybe not even the primary one), hence we need to check for the
14implied plane.
15
16v2: don't forget setcrtc ioctl.
17
18v3: Still allow disabling of the crtc in SETCRTC.
19
20Cc: stable@vger.kernel.org
21Cc: Keith Packard <keithp@keithp.com>
22Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
23Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
24Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-6-daniel.vetter@ffwll.ch
25Signed-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;