diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-04-26 13:29:37 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-04-27 04:05:54 -0400 |
commit | e975eef07cbca53691f504318609bb95c7e5f1ac (patch) | |
tree | abcda5fb47fba8b852b0ee08c4ddea87b37fbe5e | |
parent | 0d787b143d83de94decb801701a005ffd3ec6823 (diff) |
drm: Forbid legacy MAP functions for DRIVER_MODESET
Like in
commit 0e975980d435d58df2d430d688b8c18778b42218
Author: Peter Antoine <peter.antoine@intel.com>
Date: Tue Jun 23 08:18:49 2015 +0100
drm: Turn off Legacy Context Functions
we need to again make an exception for nouveau, but everyone else
really doesn't need this.
Dave Airlie dug out again why we need this: The problem is the legacy
dri1 open function the nouveau ddx called, and the problematic code is
actually in the X server itself. It was only fixed in
commit b1a630b48210d6a3c44994fce1b73273000ace5c
Author: Dave Airlie <airlied@redhat.com>
Date: Wed Nov 7 14:45:14 2012 +1000
nouveau: drop DRI1 device open interface.
Cc: Peter Antoine <peter.antoine@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1461691808-12414-5-git-send-email-daniel.vetter@ffwll.ch
Link: http://patchwork.freedesktop.org/patch/msgid/1461691808-12414-6-git-send-email-daniel.vetter@ffwll.ch
-rw-r--r-- | drivers/gpu/drm/drm_bufs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index d92db7007f62..e8a12a4fd400 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, | |||
396 | if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM)) | 396 | if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM)) |
397 | return -EPERM; | 397 | return -EPERM; |
398 | 398 | ||
399 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | ||
400 | drm_core_check_feature(dev, DRIVER_MODESET)) | ||
401 | return -EINVAL; | ||
402 | |||
399 | err = drm_addmap_core(dev, map->offset, map->size, map->type, | 403 | err = drm_addmap_core(dev, map->offset, map->size, map->type, |
400 | map->flags, &maplist); | 404 | map->flags, &maplist); |
401 | 405 | ||
@@ -438,6 +442,10 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data, | |||
438 | int idx; | 442 | int idx; |
439 | int i; | 443 | int i; |
440 | 444 | ||
445 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | ||
446 | drm_core_check_feature(dev, DRIVER_MODESET)) | ||
447 | return -EINVAL; | ||
448 | |||
441 | idx = map->offset; | 449 | idx = map->offset; |
442 | if (idx < 0) | 450 | if (idx < 0) |
443 | return -EINVAL; | 451 | return -EINVAL; |
@@ -569,6 +577,10 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data, | |||
569 | struct drm_map_list *r_list; | 577 | struct drm_map_list *r_list; |
570 | int ret; | 578 | int ret; |
571 | 579 | ||
580 | if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && | ||
581 | drm_core_check_feature(dev, DRIVER_MODESET)) | ||
582 | return -EINVAL; | ||
583 | |||
572 | mutex_lock(&dev->struct_mutex); | 584 | mutex_lock(&dev->struct_mutex); |
573 | list_for_each_entry(r_list, &dev->maplist, head) { | 585 | list_for_each_entry(r_list, &dev->maplist, head) { |
574 | if (r_list->map && | 586 | if (r_list->map && |