Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cap/cap.c

    rc1f68b0 rce732e74  
    8484
    8585static slab_cache_t *cap_slab;
     86
     87static kobject_t *cap_unpublish_locked(task_t *, cap_handle_t, kobject_type_t);
    8688
    8789static size_t caps_hash(const ht_link_t *item)
     
    148150void caps_task_init(task_t *task)
    149151{
    150         mutex_initialize(&task->cap_info->lock, MUTEX_RECURSIVE);
     152        mutex_initialize(&task->cap_info->lock, MUTEX_PASSIVE);
    151153
    152154        for (kobject_type_t t = 0; t < KOBJECT_TYPE_MAX; t++)
     
    238240        if (cap->state == CAP_STATE_PUBLISHED && cap->kobject->ops->reclaim &&
    239241            cap->kobject->ops->reclaim(cap->kobject)) {
    240                 kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
     242                kobject_t *kobj = cap_unpublish_locked(cap->task, cap->handle,
    241243                    cap->kobject->type);
    242244                kobject_put(kobj);
     
    318320}
    319321
    320 /** Unpublish published capability
    321  *
    322  * The kernel object is moved out of the capability. In other words, the
    323  * capability's reference to the objects is handed over to the kernel object
    324  * pointer returned by this function. Once unpublished, the capability does not
    325  * refer to any kernel object anymore.
    326  *
    327  * @param task    Task in which to unpublish the capability.
    328  * @param handle  Capability handle.
    329  * @param type    Kernel object type of the object associated with the
    330  *                capability.
    331  */
    332 kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
     322static kobject_t *
     323cap_unpublish_locked(task_t *task, cap_handle_t handle, kobject_type_t type)
    333324{
    334325        kobject_t *kobj = NULL;
    335326
    336         mutex_lock(&task->cap_info->lock);
    337327        cap_t *cap = cap_get(task, handle, CAP_STATE_PUBLISHED);
    338328        if (cap) {
     
    345335                }
    346336        }
     337
     338        return kobj;
     339}
     340
     341/** Unpublish published capability
     342 *
     343 * The kernel object is moved out of the capability. In other words, the
     344 * capability's reference to the objects is handed over to the kernel object
     345 * pointer returned by this function. Once unpublished, the capability does not
     346 * refer to any kernel object anymore.
     347 *
     348 * @param task    Task in which to unpublish the capability.
     349 * @param handle  Capability handle.
     350 * @param type    Kernel object type of the object associated with the
     351 *                capability.
     352 */
     353kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
     354{
     355
     356        mutex_lock(&task->cap_info->lock);
     357        kobject_t *kobj = cap_unpublish_locked(task, handle, type);
    347358        mutex_unlock(&task->cap_info->lock);
    348359
Note: See TracChangeset for help on using the changeset viewer.