aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-02-28 09:49:08 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-04-24 05:30:32 -0400
commit204f640da6914844b3270b41b29c84f6e3b74083 (patch)
treee30019685abf08d48b9a52692c16a2cea8a60cb6
parent46b757780dfe60596124b85befa935554dba73a3 (diff)
drm/lease: Make sure implicit planes are leased
If userspace doesn't enable universal planes, then we automatically add the primary and cursor planes. But for universal userspace there's no such check (and maybe we only want to give the lessee one plane, maybe not even the primary one), hence we need to check for the implied plane. v2: don't forget setcrtc ioctl. v3: Still allow disabling of the crtc in SETCRTC. Cc: stable@vger.kernel.org Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-6-daniel.vetter@ffwll.ch
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
-rw-r--r--drivers/gpu/drm/drm_plane.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 7dabbaf033a1..790ba5941954 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -559,6 +559,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
559 559
560 plane = crtc->primary; 560 plane = crtc->primary;
561 561
562 /* allow disabling with the primary plane leased */
563 if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id))
564 return -EACCES;
565
562 mutex_lock(&crtc->dev->mode_config.mutex); 566 mutex_lock(&crtc->dev->mode_config.mutex);
563 DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 567 DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx,
564 DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret); 568 DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 4cfb56893b7f..d6ad60ab0d38 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -960,6 +960,11 @@ retry:
960 if (ret) 960 if (ret)
961 goto out; 961 goto out;
962 962
963 if (!drm_lease_held(file_priv, crtc->cursor->base.id)) {
964 ret = -EACCES;
965 goto out;
966 }
967
963 ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx); 968 ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx);
964 goto out; 969 goto out;
965 } 970 }
@@ -1062,6 +1067,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
1062 1067
1063 plane = crtc->primary; 1068 plane = crtc->primary;
1064 1069
1070 if (!drm_lease_held(file_priv, plane->base.id))
1071 return -EACCES;
1072
1065 if (crtc->funcs->page_flip_target) { 1073 if (crtc->funcs->page_flip_target) {
1066 u32 current_vblank; 1074 u32 current_vblank;
1067 int r; 1075 int r;