Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/ttm Actually do DRM_SUSER che...



details:   https://anonhg.NetBSD.org/src/rev/e76e67181e06
branches:  trunk
changeset: 992772:e76e67181e06
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:45:12 2018 +0000

description:
Actually do DRM_SUSER check for mapping >1 page in kernel.

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 6120c77e8a1b -r e76e67181e06 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c  Mon Aug 27 07:45:02 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c  Mon Aug 27 07:45:12 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttm_bo_util.c,v 1.8 2018/08/27 07:45:02 riastradh Exp $        */
+/*     $NetBSD: ttm_bo_util.c,v 1.9 2018/08/27 07:45:12 riastradh Exp $        */
 
 /**************************************************************************
  *
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.8 2018/08/27 07:45:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.9 2018/08/27 07:45:12 riastradh Exp $");
 
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_placement.h>
@@ -48,6 +48,7 @@
 
 #ifdef __NetBSD__              /* PMAP_* caching flags for ttm_io_prot */
 #include <uvm/uvm_pmap.h>
+#include <drm/drm_auth_netbsd.h>
 #endif
 
 void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
@@ -723,10 +724,12 @@
                return -EINVAL;
        if (start_page > bo->num_pages)
                return -EINVAL;
-#if 0
+#ifdef __NetBSD__
+       if (num_pages > 1 && !DRM_SUSER())
+#else
        if (num_pages > 1 && !capable(CAP_SYS_ADMIN))
+#endif
                return -EPERM;
-#endif
        (void) ttm_mem_io_lock(man, false);
        ret = ttm_mem_io_reserve(bo->bdev, &bo->mem);
        ttm_mem_io_unlock(man);



Home | Main Index | Thread Index | Old Index