提交 73cb00d0 编写于 作者: D Daniel Vetter 提交者: Xie XiuQi

drm/lease: Make sure implicit planes are leased

commit 204f640d upstream.

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: NBoris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-6-daniel.vetter@ffwll.chSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 2c35417c
...@@ -595,6 +595,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -595,6 +595,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
plane = crtc->primary; 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); mutex_lock(&crtc->dev->mode_config.mutex);
drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
retry: retry:
......
...@@ -940,6 +940,11 @@ static int drm_mode_cursor_common(struct drm_device *dev, ...@@ -940,6 +940,11 @@ static int drm_mode_cursor_common(struct drm_device *dev,
if (ret) if (ret)
goto out; 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); ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx);
goto out; goto out;
} }
...@@ -1042,6 +1047,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, ...@@ -1042,6 +1047,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
plane = crtc->primary; plane = crtc->primary;
if (!drm_lease_held(file_priv, plane->base.id))
return -EACCES;
if (crtc->funcs->page_flip_target) { if (crtc->funcs->page_flip_target) {
u32 current_vblank; u32 current_vblank;
int r; int r;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册