diff options
author | 2019-06-10 04:40:13 +0000 | |
---|---|---|
committer | 2019-06-10 04:40:13 +0000 | |
commit | 7af3c06833093c8d93084891ab1de956d65c5e14 (patch) | |
tree | fa4b22c86da24112c81d89fb10ca7b5d349ee603 | |
parent | Avoid changing resource limits in rucheck() by introducing a new state (diff) | |
download | wireguard-openbsd-7af3c06833093c8d93084891ab1de956d65c5e14.tar.xz wireguard-openbsd-7af3c06833093c8d93084891ab1de956d65c5e14.zip |
drm/lease: Make sure implicit planes are leased
From Daniel Vetter
390a0fd31b02f2f7086af2f3bdb8ae576b9a4b84 in linux 4.19.y/4.19.49
204f640da6914844b3270b41b29c84f6e3b74083 in mainline linux
-rw-r--r-- | sys/dev/pci/drm/drm_crtc.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_plane.c | 8 |
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; |