drm: Reject page_flip for !DRIVER_MODESET
authorDaniel Vetter <[email protected]>
Sat, 20 Aug 2016 10:22:11 +0000 (12:22 +0200)
committerDave Airlie <[email protected]>
Mon, 22 Aug 2016 03:29:44 +0000 (13:29 +1000)
Somehow this one slipped through, which means drivers without modeset
support can be oopsed (since those also don't call
drm_mode_config_init, which means the crtc lookup will chase an
uninitalized idr).

Reported-by: Alexander Potapenko <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: [email protected]
Signed-off-by: Daniel Vetter <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
drivers/gpu/drm/drm_crtc.c

index b1dbb60af99fa79a796174dc560973b34ba6c4cc..ddebe54cd5ca673dd6ba213efcc18664b8278916 100644 (file)
@@ -5404,6 +5404,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
        struct drm_pending_vblank_event *e = NULL;
        int ret = -EINVAL;
 
+       if (!drm_core_check_feature(dev, DRIVER_MODESET))
+               return -EINVAL;
+
        if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS ||
            page_flip->reserved != 0)
                return -EINVAL;