Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/atomic: -EACCESS for lease-denied crtc lookup

With the previous patch drm_crtc_find will return NULL when the crtc
isn't in our lease, which will then disable the plane/connector. No
longer an issue since the lessor can't escape their lease terms
anymore, but not quite great semantics yet either.

Catch this and return -EACCES, so that at least evil test cases have a
better chance of making sure the kernel works correctly.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-8-daniel.vetter@ffwll.ch

+4
+4
drivers/gpu/drm/drm_atomic_uapi.c
··· 539 539 540 540 } else if (property == config->prop_crtc_id) { 541 541 struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val); 542 + if (val && !crtc) 543 + return -EACCES; 542 544 return drm_atomic_set_crtc_for_plane(state, crtc); 543 545 } else if (property == config->prop_crtc_x) { 544 546 state->crtc_x = U642I64(val); ··· 679 677 680 678 if (property == config->prop_crtc_id) { 681 679 struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val); 680 + if (val && !crtc) 681 + return -EACCES; 682 682 return drm_atomic_set_crtc_for_connector(state, crtc); 683 683 } else if (property == config->dpms_property) { 684 684 /* setting DPMS property requires special handling, which