hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/kernel/kcmp.c
....@@ -75,25 +75,25 @@
7575 return file;
7676 }
7777
78
-static void kcmp_unlock(struct mutex *m1, struct mutex *m2)
78
+static void kcmp_unlock(struct rw_semaphore *l1, struct rw_semaphore *l2)
7979 {
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);
8383 }
8484
85
-static int kcmp_lock(struct mutex *m1, struct mutex *m2)
85
+static int kcmp_lock(struct rw_semaphore *l1, struct rw_semaphore *l2)
8686 {
8787 int err;
8888
89
- if (m2 > m1)
90
- swap(m1, m2);
89
+ if (l2 > l1)
90
+ swap(l1, l2);
9191
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);
9595 if (err)
96
- mutex_unlock(m1);
96
+ up_read(l1);
9797 }
9898
9999 return err;
....@@ -173,8 +173,8 @@
173173 /*
174174 * One should have enough rights to inspect task details.
175175 */
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);
178178 if (ret)
179179 goto err;
180180 if (!ptrace_may_access(task1, PTRACE_MODE_READ_REALCREDS) ||
....@@ -229,8 +229,8 @@
229229 }
230230
231231 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);
234234 err:
235235 put_task_struct(task1);
236236 put_task_struct(task2);