summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2019-05-02 09:47:17 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2019-05-02 09:47:17 +0000
commit47a2bc427fd21ddd84dbf0e8e29cb57457c5cd5f (patch)
tree8f7547619091d5ed3dc4a1d368f6702653f77244 /sys/dev
parent913fe1d3588f03308c5d9b082264f84b26b0e3ca (diff)
Allow non-root users to become master when they are the first to open a drm
device. This matches what Linux does and is a first step towards running X without setuid or root priviliges. ok jsg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drm_drv.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index 53677bd6e4f..aed8d64de7c 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_drv.c,v 1.160 2019/04/28 08:18:16 kettenis Exp $ */
+/* $OpenBSD: drm_drv.c,v 1.161 2019/05/02 09:47:16 kettenis Exp $ */
/*-
* Copyright 2007-2009 Owain G. Ainsworth <oga@openbsd.org>
* Copyright © 2008 Intel Corporation
@@ -589,15 +589,11 @@ drmopen(dev_t kdev, int flags, int fmt, struct proc *p)
}
mutex_lock(&dev->struct_mutex);
- /* first opener automatically becomes master if root */
- if (SPLAY_EMPTY(&dev->files) && !DRM_SUSER(p)) {
- mutex_unlock(&dev->struct_mutex);
- ret = EPERM;
- goto out_prime_destroy;
- }
-
+ /* first opener automatically becomes master */
if (drm_is_primary_client(file_priv))
file_priv->is_master = SPLAY_EMPTY(&dev->files);
+ if (file_priv->is_master)
+ file_priv->authenticated = 1;
SPLAY_INSERT(drm_file_tree, &dev->files, file_priv);
mutex_unlock(&dev->struct_mutex);