Lines Matching refs: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;
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,
122 file = idr_find(&file_priv->master->magic_map, auth->magic);
125 idr_replace(&file_priv->master->magic_map, NULL, auth->magic);
134 struct drm_master *master;
136 master = kzalloc(sizeof(*master), GFP_KERNEL);
137 if (!master)
140 kref_init(&master->refcount);
141 idr_init_base(&master->magic_map, 1);
142 master->dev = dev;
145 INIT_LIST_HEAD(&master->lessees);
146 INIT_LIST_HEAD(&master->lessee_list);
147 idr_init(&master->leases);
148 idr_init_base(&master->lessee_idr, 1);
150 return master;
156 dev->master = drm_master_get(fpriv->master);
171 old_master = fpriv->master;
176 fpriv->master = new_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.
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) {
265 if (!file_priv->master) {
275 if (file_priv->master->lessor != NULL) {
277 "Attempt to set lessee %d as master\n",
278 file_priv->master->lessee_id);
294 drm_master_put(&dev->master);
313 if (!dev->master) {
318 if (file_priv->master->lessor != NULL) {
320 "Attempt to drop lessee %d as master\n",
321 file_priv->master->lessee_id);
337 /* if there is no current master make this fd it, but do not create
338 * any master object for render clients
341 if (!dev->master) {
345 file_priv->master = drm_master_get(dev->master);
356 struct drm_master *master;
359 master = file_priv->master;
361 idr_remove(&file_priv->master->magic_map, file_priv->magic);
366 if (dev->master == file_priv->master)
371 * this is the "real" master
373 drm_lease_revoke(master);
376 /* drop the master reference held by the file priv */
377 if (file_priv->master)
378 drm_master_put(&file_priv->master);
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)
390 kref_get(&master->refcount);
391 return master;
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.
407 struct drm_master *master = NULL;
410 if (!file_priv->master)
412 master = drm_master_get(file_priv->master);
416 return master;
422 struct drm_master *master = container_of(kref, struct drm_master, refcount);
423 struct drm_device *dev = master->dev;
426 drm_lease_destroy(master);
428 idr_destroy(&master->magic_map);
429 idr_destroy(&master->leases);
430 idr_destroy(&master->lessee_idr);
432 kfree(master->unique);
433 kfree(master);
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)
444 kref_put(&(*master)->refcount, drm_master_destroy);
445 *master = NULL;
453 if (dev->master) {