| .. | .. |
|---|
| 75 | 75 | return file; |
|---|
| 76 | 76 | } |
|---|
| 77 | 77 | |
|---|
| 78 | | -static void kcmp_unlock(struct mutex *m1, struct mutex *m2) |
|---|
| 78 | +static void kcmp_unlock(struct rw_semaphore *l1, struct rw_semaphore *l2) |
|---|
| 79 | 79 | { |
|---|
| 80 | | - if (likely(m2 != m1)) |
|---|
| 81 | | - mutex_unlock(m2); |
|---|
| 82 | | - mutex_unlock(m1); |
|---|
| 80 | + if (likely(l2 != l1)) |
|---|
| 81 | + up_read(l2); |
|---|
| 82 | + up_read(l1); |
|---|
| 83 | 83 | } |
|---|
| 84 | 84 | |
|---|
| 85 | | -static int kcmp_lock(struct mutex *m1, struct mutex *m2) |
|---|
| 85 | +static int kcmp_lock(struct rw_semaphore *l1, struct rw_semaphore *l2) |
|---|
| 86 | 86 | { |
|---|
| 87 | 87 | int err; |
|---|
| 88 | 88 | |
|---|
| 89 | | - if (m2 > m1) |
|---|
| 90 | | - swap(m1, m2); |
|---|
| 89 | + if (l2 > l1) |
|---|
| 90 | + swap(l1, l2); |
|---|
| 91 | 91 | |
|---|
| 92 | | - err = mutex_lock_killable(m1); |
|---|
| 93 | | - if (!err && likely(m1 != m2)) { |
|---|
| 94 | | - err = mutex_lock_killable_nested(m2, SINGLE_DEPTH_NESTING); |
|---|
| 92 | + err = down_read_killable(l1); |
|---|
| 93 | + if (!err && likely(l1 != l2)) { |
|---|
| 94 | + err = down_read_killable_nested(l2, SINGLE_DEPTH_NESTING); |
|---|
| 95 | 95 | if (err) |
|---|
| 96 | | - mutex_unlock(m1); |
|---|
| 96 | + up_read(l1); |
|---|
| 97 | 97 | } |
|---|
| 98 | 98 | |
|---|
| 99 | 99 | return err; |
|---|
| .. | .. |
|---|
| 173 | 173 | /* |
|---|
| 174 | 174 | * One should have enough rights to inspect task details. |
|---|
| 175 | 175 | */ |
|---|
| 176 | | - ret = kcmp_lock(&task1->signal->cred_guard_mutex, |
|---|
| 177 | | - &task2->signal->cred_guard_mutex); |
|---|
| 176 | + ret = kcmp_lock(&task1->signal->exec_update_lock, |
|---|
| 177 | + &task2->signal->exec_update_lock); |
|---|
| 178 | 178 | if (ret) |
|---|
| 179 | 179 | goto err; |
|---|
| 180 | 180 | if (!ptrace_may_access(task1, PTRACE_MODE_READ_REALCREDS) || |
|---|
| .. | .. |
|---|
| 229 | 229 | } |
|---|
| 230 | 230 | |
|---|
| 231 | 231 | err_unlock: |
|---|
| 232 | | - kcmp_unlock(&task1->signal->cred_guard_mutex, |
|---|
| 233 | | - &task2->signal->cred_guard_mutex); |
|---|
| 232 | + kcmp_unlock(&task1->signal->exec_update_lock, |
|---|
| 233 | + &task2->signal->exec_update_lock); |
|---|
| 234 | 234 | err: |
|---|
| 235 | 235 | put_task_struct(task1); |
|---|
| 236 | 236 | put_task_struct(task2); |
|---|