aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/net.h3
-rw-r--r--include/net/sock.h7
2 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/net.h b/include/linux/net.h
index 16faa130088c..94de83c0f877 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -118,6 +118,7 @@ enum sock_shutdown_cmd {
118}; 118};
119 119
120struct socket_wq { 120struct socket_wq {
121 /* Note: wait MUST be first field of socket_wq */
121 wait_queue_head_t wait; 122 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list; 123 struct fasync_struct *fasync_list;
123 struct rcu_head rcu; 124 struct rcu_head rcu;
@@ -142,7 +143,7 @@ struct socket {
142 143
143 unsigned long flags; 144 unsigned long flags;
144 145
145 struct socket_wq *wq; 146 struct socket_wq __rcu *wq;
146 147
147 struct file *file; 148 struct file *file;
148 struct sock *sk; 149 struct sock *sk;
diff --git a/include/net/sock.h b/include/net/sock.h
index e3893a2b5d25..da0534d3401c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -281,7 +281,7 @@ struct sock {
281 int sk_rcvbuf; 281 int sk_rcvbuf;
282 282
283 struct sk_filter __rcu *sk_filter; 283 struct sk_filter __rcu *sk_filter;
284 struct socket_wq *sk_wq; 284 struct socket_wq __rcu *sk_wq;
285 285
286#ifdef CONFIG_NET_DMA 286#ifdef CONFIG_NET_DMA
287 struct sk_buff_head sk_async_wait_queue; 287 struct sk_buff_head sk_async_wait_queue;
@@ -1266,7 +1266,8 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1266 1266
1267static inline wait_queue_head_t *sk_sleep(struct sock *sk) 1267static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1268{ 1268{
1269 return &sk->sk_wq->wait; 1269 BUILD_BUG_ON(offsetof(struct socket_wq, wait) != 0);
1270 return &rcu_dereference_raw(sk->sk_wq)->wait;
1270} 1271}
1271/* Detach socket from process context. 1272/* Detach socket from process context.
1272 * Announce socket dead, detach it from wait queue and inode. 1273 * Announce socket dead, detach it from wait queue and inode.
@@ -1287,7 +1288,7 @@ static inline void sock_orphan(struct sock *sk)
1287static inline void sock_graft(struct sock *sk, struct socket *parent) 1288static inline void sock_graft(struct sock *sk, struct socket *parent)
1288{ 1289{
1289 write_lock_bh(&sk->sk_callback_lock); 1290 write_lock_bh(&sk->sk_callback_lock);
1290 rcu_assign_pointer(sk->sk_wq, parent->wq); 1291 sk->sk_wq = parent->wq;
1291 parent->sk = sk; 1292 parent->sk = sk;
1292 sk_set_socket(sk, parent); 1293 sk_set_socket(sk, parent);
1293 security_sock_graft(sk, parent); 1294 security_sock_graft(sk, parent);