Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ops/stchngath.c

    r48bcf49 rb1e6269  
    4343static int request_preprocess(call_t *call, phone_t *phone)
    4444{
     45        phone_t *sender_phone;
    4546        task_t *other_task_s;
    4647
    47         kobject_t *sender_obj = kobject_get(TASK, IPC_GET_ARG5(call->data),
    48             KOBJECT_TYPE_PHONE);
    49         if (!sender_obj)
     48        if (phone_get(IPC_GET_ARG5(call->data), &sender_phone) != EOK)
    5049                return ENOENT;
    5150
    52         mutex_lock(&sender_obj->phone->lock);
    53         if (sender_obj->phone->state != IPC_PHONE_CONNECTED) {
    54                 mutex_unlock(&sender_obj->phone->lock);
    55                 kobject_put(sender_obj);
     51        mutex_lock(&sender_phone->lock);
     52        if (sender_phone->state != IPC_PHONE_CONNECTED) {
     53                mutex_unlock(&sender_phone->lock);
    5654                return EINVAL;
    5755        }
    5856
    59         other_task_s = sender_obj->phone->callee->task;
     57        other_task_s = sender_phone->callee->task;
    6058
    61         mutex_unlock(&sender_obj->phone->lock);
     59        mutex_unlock(&sender_phone->lock);
    6260
    6361        /* Remember the third party task hash. */
    6462        IPC_SET_ARG5(call->data, (sysarg_t) other_task_s);
    6563
    66         kobject_put(sender_obj);
    6764        return EOK;
    6865}
     
    7471        if (!IPC_GET_RETVAL(answer->data)) {
    7572                /* The recipient authorized the change of state. */
     73                phone_t *recipient_phone;
    7674                task_t *other_task_s;
    7775                task_t *other_task_r;
    7876
    79                 kobject_t *recipient_obj = kobject_get(TASK,
    80                     IPC_GET_ARG1(answer->data), KOBJECT_TYPE_PHONE);
    81                 if (!recipient_obj) {
     77                rc = phone_get(IPC_GET_ARG1(answer->data),
     78                    &recipient_phone);
     79                if (rc != EOK) {
    8280                        IPC_SET_RETVAL(answer->data, ENOENT);
    8381                        return ENOENT;
    8482                }
    8583
    86                 mutex_lock(&recipient_obj->phone->lock);
    87                 if (recipient_obj->phone->state != IPC_PHONE_CONNECTED) {
    88                         mutex_unlock(&recipient_obj->phone->lock);
     84                mutex_lock(&recipient_phone->lock);
     85                if (recipient_phone->state != IPC_PHONE_CONNECTED) {
     86                        mutex_unlock(&recipient_phone->lock);
    8987                        IPC_SET_RETVAL(answer->data, EINVAL);
    90                         kobject_put(recipient_obj);
    9188                        return EINVAL;
    9289                }
    9390
    94                 other_task_r = recipient_obj->phone->callee->task;
     91                other_task_r = recipient_phone->callee->task;
    9592                other_task_s = (task_t *) IPC_GET_ARG5(*olddata);
    9693
     
    113110                }
    114111
    115                 mutex_unlock(&recipient_obj->phone->lock);
    116                 kobject_put(recipient_obj);
     112                mutex_unlock(&recipient_phone->lock);
    117113        }
    118114
Note: See TracChangeset for help on using the changeset viewer.