Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/drm Replace capable(CAP_...



details:   https://anonhg.NetBSD.org/src/rev/7d166ea56abe
branches:  riastradh-drm2
changeset: 788075:7d166ea56abe
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 24 02:06:53 2013 +0000

description:
Replace capable(CAP_SYS_ADMIN) by DRM_SUSER() in drm_bufs.c.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_bufs.c |  24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diffs (63 lines):

diff -r c713a626d228 -r 7d166ea56abe sys/external/bsd/drm2/dist/drm/drm_bufs.c
--- a/sys/external/bsd/drm2/dist/drm/drm_bufs.c Wed Jul 24 02:06:38 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_bufs.c Wed Jul 24 02:06:53 2013 +0000
@@ -415,8 +415,17 @@
        struct drm_map_list *maplist;
        int err;
 
+#ifdef __NetBSD__
+#  if 0                                /* XXX Old drm did this.  */
+       if (!(dev->flags & (FREAD | FWRITE)))
+               return -EACCES;
+#  endif
+       if (!(DRM_SUSER() || map->type == _DRM_AGP || map->type == _DRM_SHM))
+               return -EACCES; /* XXX */
+#else
        if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
                return -EPERM;
+#endif
 
        err = drm_addmap_core(dev, map->offset, map->size, map->type,
                              map->flags, &maplist);
@@ -811,8 +820,13 @@
        if (!dma)
                return -EINVAL;
 
+#ifdef __NetBSD__
+       if (!DRM_SUSER())
+               return -EACCES; /* XXX */
+#else
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
+#endif
 
        count = request->count;
        order = drm_order(request->size);
@@ -1017,8 +1031,13 @@
        if (!dma)
                return -EINVAL;
 
+#ifdef __NetBSD__
+       if (!DRM_SUSER())
+               return -EACCES; /* XXX */
+#else
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
+#endif
 
        count = request->count;
        order = drm_order(request->size);
@@ -1172,8 +1191,13 @@
        if (!dma)
                return -EINVAL;
 
+#ifdef __NetBSD__
+       if (!DRM_SUSER())
+               return -EACCES; /* XXX */
+#else
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
+#endif
 
        count = request->count;
        order = drm_order(request->size);



Home | Main Index | Thread Index | Old Index