summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-06-10 04:40:14 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-06-10 04:40:14 +0000
commit4b6c430abe977ddc4f472137e4fe00e6cde3fd5b (patch)
tree17a47e3219e4491e1c20fc168619ddd2754489c6 /sys/dev/pci
parent8b7de691cc69919ba3a5f0cc6aaff826d89fa81c (diff)
drm/lease: Make sure implicit planes are leased
From Daniel Vetter 390a0fd31b02f2f7086af2f3bdb8ae576b9a4b84 in linux 4.19.y/4.19.49 204f640da6914844b3270b41b29c84f6e3b74083 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/drm_crtc.c4
-rw-r--r--sys/dev/pci/drm/drm_plane.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/drm_crtc.c b/sys/dev/pci/drm/drm_crtc.c
index 31b218b64b2..5f5d8f3fd50 100644
--- a/sys/dev/pci/drm/drm_crtc.c
+++ b/sys/dev/pci/drm/drm_crtc.c
@@ -597,6 +597,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
plane = crtc->primary;
+ /* allow disabling with the primary plane leased */
+ if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id))
+ return -EACCES;
+
mutex_lock(&crtc->dev->mode_config.mutex);
drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry:
diff --git a/sys/dev/pci/drm/drm_plane.c b/sys/dev/pci/drm/drm_plane.c
index 042c8100ed5..adc9ef10135 100644
--- a/sys/dev/pci/drm/drm_plane.c
+++ b/sys/dev/pci/drm/drm_plane.c
@@ -942,6 +942,11 @@ retry:
if (ret)
goto out;
+ if (!drm_lease_held(file_priv, crtc->cursor->base.id)) {
+ ret = -EACCES;
+ goto out;
+ }
+
ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx);
goto out;
}
@@ -1044,6 +1049,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
plane = crtc->primary;
+ if (!drm_lease_held(file_priv, plane->base.id))
+ return -EACCES;
+
if (crtc->funcs->page_flip_target) {
u32 current_vblank;
int r;