Lines Matching full:master

43  * DOC: master and authentication
47 * least once successfully became the device master (either through the
49 * no one else is the current master that time) there exists one &drm_master.
53 * In addition only one &drm_master can be the current master for a &drm_device.
58 * Clients can authenticate against the current master (if it matches their own)
69 return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master; in drm_is_current_master_locked()
73 * drm_is_current_master - checks whether @priv is the current master
76 * Checks whether @fpriv is current master on its device. This decides whether a
80 * - the current master is assumed to own the non-shareable display hardware.
101 ret = idr_alloc(&file_priv->master->magic_map, file_priv, in drm_getmagic()
122 file = idr_find(&file_priv->master->magic_map, auth->magic); in drm_authmagic()
125 idr_replace(&file_priv->master->magic_map, NULL, auth->magic); in drm_authmagic()
133 struct drm_master *master; in drm_master_create() local
135 master = kzalloc_obj(*master); in drm_master_create()
136 if (!master) in drm_master_create()
139 kref_init(&master->refcount); in drm_master_create()
140 idr_init_base(&master->magic_map, 1); in drm_master_create()
141 master->dev = dev; in drm_master_create()
144 INIT_LIST_HEAD(&master->lessees); in drm_master_create()
145 INIT_LIST_HEAD(&master->lessee_list); in drm_master_create()
146 idr_init(&master->leases); in drm_master_create()
147 idr_init_base(&master->lessee_idr, 1); in drm_master_create()
149 return master; in drm_master_create()
155 dev->master = drm_master_get(fpriv->master); in drm_set_master()
170 old_master = fpriv->master; in drm_new_set_master()
175 fpriv->master = new_master; in drm_new_set_master()
192 * from becoming master and/or failing to release it.
194 * At the same time, the first client (for a given VT) is _always_ master.
198 * If the CAP_SYS_ADMIN was missing, no other client could become master...
204 * master as applicable. It does so by opening the fd and passing it to users
205 * while in itself logind a) does the set/drop master per users' request and
206 * b) * implicitly drops master on VT switch.
210 * root is required _solely_ for SET/DROP MASTER.
212 * - any client which fails to drop master* can DoS the application using
220 * - allow a client to drop/set master, iff it is/was master at a given point
225 * - open the node, become master implicitly and cause issues
259 if (dev->master) in drm_setmaster_ioctl()
262 if (!file_priv->master) in drm_setmaster_ioctl()
268 if (file_priv->master->lessor != NULL) { in drm_setmaster_ioctl()
270 "Attempt to set lessee %d as master\n", in drm_setmaster_ioctl()
271 file_priv->master->lessee_id); in drm_setmaster_ioctl()
285 drm_master_put(&dev->master); in drm_drop_master()
302 if (!dev->master) in drm_dropmaster_ioctl()
305 if (file_priv->master->lessor != NULL) { in drm_dropmaster_ioctl()
307 "Attempt to drop lessee %d as master\n", in drm_dropmaster_ioctl()
308 file_priv->master->lessee_id); in drm_dropmaster_ioctl()
322 /* if there is no current master make this fd it, but do not create in drm_master_open()
323 * any master object for render clients in drm_master_open()
326 if (!dev->master) { in drm_master_open()
330 file_priv->master = drm_master_get(dev->master); in drm_master_open()
340 struct drm_master *master; in drm_master_release() local
343 master = file_priv->master; in drm_master_release()
345 idr_remove(&file_priv->master->magic_map, file_priv->magic); in drm_master_release()
350 if (dev->master == file_priv->master) in drm_master_release()
355 * this is the "real" master in drm_master_release()
357 drm_lease_revoke(master); in drm_master_release()
360 /* drop the master reference held by the file priv */ in drm_master_release()
361 if (file_priv->master) in drm_master_release()
362 drm_master_put(&file_priv->master); in drm_master_release()
366 * drm_master_get - reference a master pointer
367 * @master: &struct drm_master
369 * Increments the reference count of @master and returns a pointer to @master.
371 struct drm_master *drm_master_get(struct drm_master *master) in drm_master_get() argument
373 kref_get(&master->refcount); in drm_master_get()
374 return master; in drm_master_get()
379 * drm_file_get_master - reference &drm_file.master of @file_priv
382 * Increments the reference count of @file_priv's &drm_file.master and returns
383 * the &drm_file.master. If @file_priv has no &drm_file.master, returns NULL.
385 * Master pointers returned from this function should be unreferenced using
390 struct drm_master *master = NULL; in drm_file_get_master() local
393 if (!file_priv->master) in drm_file_get_master()
395 master = drm_master_get(file_priv->master); in drm_file_get_master()
399 return master; in drm_file_get_master()
405 struct drm_master *master = container_of(kref, struct drm_master, refcount); in drm_master_destroy() local
406 struct drm_device *dev = master->dev; in drm_master_destroy()
409 drm_lease_destroy(master); in drm_master_destroy()
411 idr_destroy(&master->magic_map); in drm_master_destroy()
412 idr_destroy(&master->leases); in drm_master_destroy()
413 idr_destroy(&master->lessee_idr); in drm_master_destroy()
415 kfree(master->unique); in drm_master_destroy()
416 kfree(master); in drm_master_destroy()
420 * drm_master_put - unreference and clear a master pointer
421 * @master: pointer to a pointer of &struct drm_master
423 * This decrements the &drm_master behind @master and sets it to NULL.
425 void drm_master_put(struct drm_master **master) in drm_master_put() argument
427 kref_put(&(*master)->refcount, drm_master_destroy); in drm_master_put()
428 *master = NULL; in drm_master_put()
436 if (dev->master) { in drm_master_internal_acquire()