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/drm Synchronize permission checks with...



details:   https://anonhg.NetBSD.org/src/rev/b7bedc125eda
branches:  trunk
changeset: 336571:b7bedc125eda
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Mar 06 14:02:39 2015 +0000

description:
Synchronize permission checks with upstream drm_ioctl_permit.

diffstat:

 sys/external/bsd/drm2/drm/drm_drv.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r d9da5b32d926 -r b7bedc125eda sys/external/bsd/drm2/drm/drm_drv.c
--- a/sys/external/bsd/drm2/drm/drm_drv.c       Fri Mar 06 13:44:18 2015 +0000
+++ b/sys/external/bsd/drm2/drm/drm_drv.c       Fri Mar 06 14:02:39 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_drv.c,v 1.13 2015/01/01 01:15:42 mrg Exp $ */
+/*     $NetBSD: drm_drv.c,v 1.14 2015/03/06 14:02:39 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2015/01/01 01:15:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.14 2015/03/06 14:02:39 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -642,19 +642,28 @@
        if ((ioctl == NULL) || (ioctl->func == NULL))
                return EINVAL;
 
+       /* XXX Synchronize with drm_ioctl_permit in upstream drm_drv.c.  */
        if (ISSET(ioctl->flags, DRM_ROOT_ONLY) && !DRM_SUSER())
                return EACCES;
 
-       if (ISSET(ioctl->flags, DRM_AUTH) && !file->authenticated)
+       if (ISSET(ioctl->flags, DRM_AUTH) &&
+           (file->minor->type != DRM_MINOR_RENDER) &&
+           !file->authenticated)
                return EACCES;
 
-       if (ISSET(ioctl->flags, DRM_MASTER) && (file->master == NULL))
+       if (ISSET(ioctl->flags, DRM_MASTER) &&
+           (file->master == NULL) &&
+           (file->minor->type != DRM_MINOR_CONTROL))
                return EACCES;
 
        if (!ISSET(ioctl->flags, DRM_CONTROL_ALLOW) &&
            (file->minor->type == DRM_MINOR_CONTROL))
                return EACCES;
 
+       if (!ISSET(ioctl->flags, DRM_RENDER_ALLOW) &&
+           (file->minor->type == DRM_MINOR_RENDER))
+               return EACCES;
+
        if (!ISSET(ioctl->flags, DRM_UNLOCKED))
                mutex_lock(&drm_global_mutex);
 



Home | Main Index | Thread Index | Old Index