.. | .. |
---|
11 | 11 | #include <linux/tcp.h> |
---|
12 | 12 | #include <linux/workqueue.h> |
---|
13 | 13 | #include <linux/nospec.h> |
---|
14 | | - |
---|
| 14 | +#include <linux/cookie.h> |
---|
15 | 15 | #include <linux/inet_diag.h> |
---|
16 | 16 | #include <linux/sock_diag.h> |
---|
17 | 17 | |
---|
.. | .. |
---|
20 | 20 | static DEFINE_MUTEX(sock_diag_table_mutex); |
---|
21 | 21 | static struct workqueue_struct *broadcast_wq; |
---|
22 | 22 | |
---|
23 | | -u64 sock_gen_cookie(struct sock *sk) |
---|
| 23 | +DEFINE_COOKIE(sock_cookie); |
---|
| 24 | + |
---|
| 25 | +u64 __sock_gen_cookie(struct sock *sk) |
---|
24 | 26 | { |
---|
25 | 27 | while (1) { |
---|
26 | 28 | u64 res = atomic64_read(&sk->sk_cookie); |
---|
27 | 29 | |
---|
28 | 30 | if (res) |
---|
29 | 31 | return res; |
---|
30 | | - res = atomic64_inc_return(&sock_net(sk)->cookie_gen); |
---|
| 32 | + res = gen_cookie_next(&sock_cookie); |
---|
31 | 33 | atomic64_cmpxchg(&sk->sk_cookie, 0, res); |
---|
32 | 34 | } |
---|
33 | 35 | } |
---|