hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/unix/scm.c
....@@ -63,7 +63,7 @@
6363 /* Paired with READ_ONCE() in wait_for_unix_gc() */
6464 WRITE_ONCE(unix_tot_inflight, unix_tot_inflight + 1);
6565 }
66
- user->unix_inflight++;
66
+ WRITE_ONCE(user->unix_inflight, user->unix_inflight + 1);
6767 spin_unlock(&unix_gc_lock);
6868 }
6969
....@@ -84,7 +84,7 @@
8484 /* Paired with READ_ONCE() in wait_for_unix_gc() */
8585 WRITE_ONCE(unix_tot_inflight, unix_tot_inflight - 1);
8686 }
87
- user->unix_inflight--;
87
+ WRITE_ONCE(user->unix_inflight, user->unix_inflight - 1);
8888 spin_unlock(&unix_gc_lock);
8989 }
9090
....@@ -98,7 +98,7 @@
9898 {
9999 struct user_struct *user = current_user();
100100
101
- if (unlikely(user->unix_inflight > task_rlimit(p, RLIMIT_NOFILE)))
101
+ if (unlikely(READ_ONCE(user->unix_inflight) > task_rlimit(p, RLIMIT_NOFILE)))
102102 return !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN);
103103 return false;
104104 }