diff options
-rw-r--r-- | include/linux/net.h | 2 | ||||
-rw-r--r-- | include/net/sock.h | 2 | ||||
-rw-r--r-- | net/socket.c | 10 |
3 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index 6554d3ba4396..e0930678c8bf 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -114,7 +114,7 @@ struct socket { | |||
114 | 114 | ||
115 | unsigned long flags; | 115 | unsigned long flags; |
116 | 116 | ||
117 | struct socket_wq __rcu *wq; | 117 | struct socket_wq *wq; |
118 | 118 | ||
119 | struct file *file; | 119 | struct file *file; |
120 | struct sock *sk; | 120 | struct sock *sk; |
diff --git a/include/net/sock.h b/include/net/sock.h index 2afea5d1bdfe..433f45fc2d68 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1788,7 +1788,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
1788 | { | 1788 | { |
1789 | WARN_ON(parent->sk); | 1789 | WARN_ON(parent->sk); |
1790 | write_lock_bh(&sk->sk_callback_lock); | 1790 | write_lock_bh(&sk->sk_callback_lock); |
1791 | sk->sk_wq = parent->wq; | 1791 | rcu_assign_pointer(sk->sk_wq, parent->wq); |
1792 | parent->sk = sk; | 1792 | parent->sk = sk; |
1793 | sk_set_socket(sk, parent); | 1793 | sk_set_socket(sk, parent); |
1794 | sk->sk_uid = SOCK_INODE(parent)->i_uid; | 1794 | sk->sk_uid = SOCK_INODE(parent)->i_uid; |
diff --git a/net/socket.c b/net/socket.c index 5b7df6695f4f..475247e347ae 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -251,7 +251,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
251 | init_waitqueue_head(&wq->wait); | 251 | init_waitqueue_head(&wq->wait); |
252 | wq->fasync_list = NULL; | 252 | wq->fasync_list = NULL; |
253 | wq->flags = 0; | 253 | wq->flags = 0; |
254 | RCU_INIT_POINTER(ei->socket.wq, wq); | 254 | ei->socket.wq = wq; |
255 | 255 | ||
256 | ei->socket.state = SS_UNCONNECTED; | 256 | ei->socket.state = SS_UNCONNECTED; |
257 | ei->socket.flags = 0; | 257 | ei->socket.flags = 0; |
@@ -265,11 +265,9 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
265 | static void sock_destroy_inode(struct inode *inode) | 265 | static void sock_destroy_inode(struct inode *inode) |
266 | { | 266 | { |
267 | struct socket_alloc *ei; | 267 | struct socket_alloc *ei; |
268 | struct socket_wq *wq; | ||
269 | 268 | ||
270 | ei = container_of(inode, struct socket_alloc, vfs_inode); | 269 | ei = container_of(inode, struct socket_alloc, vfs_inode); |
271 | wq = rcu_dereference_protected(ei->socket.wq, 1); | 270 | kfree_rcu(ei->socket.wq, rcu); |
272 | kfree_rcu(wq, rcu); | ||
273 | kmem_cache_free(sock_inode_cachep, ei); | 271 | kmem_cache_free(sock_inode_cachep, ei); |
274 | } | 272 | } |
275 | 273 | ||
@@ -603,7 +601,7 @@ static void __sock_release(struct socket *sock, struct inode *inode) | |||
603 | module_put(owner); | 601 | module_put(owner); |
604 | } | 602 | } |
605 | 603 | ||
606 | if (rcu_dereference_protected(sock->wq, 1)->fasync_list) | 604 | if (sock->wq->fasync_list) |
607 | pr_err("%s: fasync list not empty!\n", __func__); | 605 | pr_err("%s: fasync list not empty!\n", __func__); |
608 | 606 | ||
609 | if (!sock->file) { | 607 | if (!sock->file) { |
@@ -1181,7 +1179,7 @@ static int sock_fasync(int fd, struct file *filp, int on) | |||
1181 | return -EINVAL; | 1179 | return -EINVAL; |
1182 | 1180 | ||
1183 | lock_sock(sk); | 1181 | lock_sock(sk); |
1184 | wq = rcu_dereference_protected(sock->wq, lockdep_sock_is_held(sk)); | 1182 | wq = sock->wq; |
1185 | fasync_helper(fd, filp, on, &wq->fasync_list); | 1183 | fasync_helper(fd, filp, on, &wq->fasync_list); |
1186 | 1184 | ||
1187 | if (!wq->fasync_list) | 1185 | if (!wq->fasync_list) |