Lines Matching full:master
42 * DOC: master and authentication
46 * least once successfully became the device master (either through the
48 * no one else is the current master that time) there exists one &drm_master.
52 * In addition only one &drm_master can be the current master for a &drm_device.
57 * Clients can authenticate against the current master (if it matches their own)
68 return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master; in drm_is_current_master_locked()
72 * drm_is_current_master - checks whether @priv is the current master
75 * Checks whether @fpriv is current master on its device. This decides whether a
79 * - the current master is assumed to own the non-shareable display hardware.
100 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()
134 struct drm_master *master; in drm_master_create() local
136 master = kzalloc(sizeof(*master), GFP_KERNEL); in drm_master_create()
137 if (!master) in drm_master_create()
140 kref_init(&master->refcount); in drm_master_create()
141 idr_init_base(&master->magic_map, 1); in drm_master_create()
142 master->dev = dev; in drm_master_create()
145 INIT_LIST_HEAD(&master->lessees); in drm_master_create()
146 INIT_LIST_HEAD(&master->lessee_list); in drm_master_create()
147 idr_init(&master->leases); in drm_master_create()
148 idr_init_base(&master->lessee_idr, 1); in drm_master_create()
150 return master; in drm_master_create()
156 dev->master = drm_master_get(fpriv->master); in drm_set_master()
171 old_master = fpriv->master; in drm_new_set_master()
176 fpriv->master = new_master; in drm_new_set_master()
193 * from becoming master and/or failing to release it.
195 * At the same time, the first client (for a given VT) is _always_ master.
199 * If the CAP_SYS_ADMIN was missing, no other client could become master...
205 * master as applicable. It does so by opening the fd and passing it to users
206 * while in itself logind a) does the set/drop master per users' request and
207 * b) * implicitly drops master on VT switch.
211 * root is required _solely_ for SET/DROP MASTER.
213 * - any client which fails to drop master* can DoS the application using
221 * - allow a client to drop/set master, iff it is/was master at a given point
226 * - open the node, become master implicitly and cause issues
260 if (dev->master) { in drm_setmaster_ioctl()
265 if (!file_priv->master) { in drm_setmaster_ioctl()
275 if (file_priv->master->lessor != NULL) { in drm_setmaster_ioctl()
277 "Attempt to set lessee %d as master\n", in drm_setmaster_ioctl()
278 file_priv->master->lessee_id); in drm_setmaster_ioctl()
294 drm_master_put(&dev->master); in drm_drop_master()
313 if (!dev->master) { in drm_dropmaster_ioctl()
318 if (file_priv->master->lessor != NULL) { in drm_dropmaster_ioctl()
320 "Attempt to drop lessee %d as master\n", in drm_dropmaster_ioctl()
321 file_priv->master->lessee_id); in drm_dropmaster_ioctl()
337 /* if there is no current master make this fd it, but do not create in drm_master_open()
338 * any master object for render clients in drm_master_open()
341 if (!dev->master) { in drm_master_open()
345 file_priv->master = drm_master_get(dev->master); in drm_master_open()
356 struct drm_master *master; in drm_master_release() local
359 master = file_priv->master; in drm_master_release()
361 idr_remove(&file_priv->master->magic_map, file_priv->magic); in drm_master_release()
366 if (dev->master == file_priv->master) in drm_master_release()
371 * this is the "real" master in drm_master_release()
373 drm_lease_revoke(master); in drm_master_release()
376 /* drop the master reference held by the file priv */ in drm_master_release()
377 if (file_priv->master) in drm_master_release()
378 drm_master_put(&file_priv->master); in drm_master_release()
383 * drm_master_get - reference a master pointer
384 * @master: &struct drm_master
386 * Increments the reference count of @master and returns a pointer to @master.
388 struct drm_master *drm_master_get(struct drm_master *master) in drm_master_get() argument
390 kref_get(&master->refcount); in drm_master_get()
391 return master; in drm_master_get()
396 * drm_file_get_master - reference &drm_file.master of @file_priv
399 * Increments the reference count of @file_priv's &drm_file.master and returns
400 * the &drm_file.master. If @file_priv has no &drm_file.master, returns NULL.
402 * Master pointers returned from this function should be unreferenced using
407 struct drm_master *master = NULL; in drm_file_get_master() local
410 if (!file_priv->master) in drm_file_get_master()
412 master = drm_master_get(file_priv->master); in drm_file_get_master()
416 return master; in drm_file_get_master()
422 struct drm_master *master = container_of(kref, struct drm_master, refcount); in drm_master_destroy() local
423 struct drm_device *dev = master->dev; in drm_master_destroy()
426 drm_lease_destroy(master); in drm_master_destroy()
428 idr_destroy(&master->magic_map); in drm_master_destroy()
429 idr_destroy(&master->leases); in drm_master_destroy()
430 idr_destroy(&master->lessee_idr); in drm_master_destroy()
432 kfree(master->unique); in drm_master_destroy()
433 kfree(master); in drm_master_destroy()
437 * drm_master_put - unreference and clear a master pointer
438 * @master: pointer to a pointer of &struct drm_master
440 * This decrements the &drm_master behind @master and sets it to NULL.
442 void drm_master_put(struct drm_master **master) in drm_master_put() argument
444 kref_put(&(*master)->refcount, drm_master_destroy); in drm_master_put()
445 *master = NULL; in drm_master_put()
453 if (dev->master) { in drm_master_internal_acquire()