aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index a7c30412de66..3f4897ab432e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -990,6 +990,11 @@ static inline void sock_put(struct sock *sk)
990extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, 990extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
991 const int nested); 991 const int nested);
992 992
993static inline void sk_set_socket(struct sock *sk, struct socket *sock)
994{
995 sk->sk_socket = sock;
996}
997
993/* Detach socket from process context. 998/* Detach socket from process context.
994 * Announce socket dead, detach it from wait queue and inode. 999 * Announce socket dead, detach it from wait queue and inode.
995 * Note that parent inode held reference count on this struct sock, 1000 * Note that parent inode held reference count on this struct sock,
@@ -1001,7 +1006,7 @@ static inline void sock_orphan(struct sock *sk)
1001{ 1006{
1002 write_lock_bh(&sk->sk_callback_lock); 1007 write_lock_bh(&sk->sk_callback_lock);
1003 sock_set_flag(sk, SOCK_DEAD); 1008 sock_set_flag(sk, SOCK_DEAD);
1004 sk->sk_socket = NULL; 1009 sk_set_socket(sk, NULL);
1005 sk->sk_sleep = NULL; 1010 sk->sk_sleep = NULL;
1006 write_unlock_bh(&sk->sk_callback_lock); 1011 write_unlock_bh(&sk->sk_callback_lock);
1007} 1012}
@@ -1011,7 +1016,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1011 write_lock_bh(&sk->sk_callback_lock); 1016 write_lock_bh(&sk->sk_callback_lock);
1012 sk->sk_sleep = &parent->wait; 1017 sk->sk_sleep = &parent->wait;
1013 parent->sk = sk; 1018 parent->sk = sk;
1014 sk->sk_socket = parent; 1019 sk_set_socket(sk, parent);
1015 security_sock_graft(sk, parent); 1020 security_sock_graft(sk, parent);
1016 write_unlock_bh(&sk->sk_callback_lock); 1021 write_unlock_bh(&sk->sk_callback_lock);
1017} 1022}