File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -990,6 +990,11 @@ static inline void sock_put(struct sock *sk)
990
990
extern int sk_receive_skb (struct sock * sk , struct sk_buff * skb ,
991
991
const int nested );
992
992
993
+ static inline void sk_set_socket (struct sock * sk , struct socket * sock )
994
+ {
995
+ sk -> sk_socket = sock ;
996
+ }
997
+
993
998
/* Detach socket from process context.
994
999
* Announce socket dead, detach it from wait queue and inode.
995
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
1007
write_lock_bh (& sk -> sk_callback_lock );
1003
1008
sock_set_flag (sk , SOCK_DEAD );
1004
- sk -> sk_socket = NULL ;
1009
+ sk_set_socket ( sk , NULL ) ;
1005
1010
sk -> sk_sleep = NULL ;
1006
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
1016
write_lock_bh (& sk -> sk_callback_lock );
1012
1017
sk -> sk_sleep = & parent -> wait ;
1013
1018
parent -> sk = sk ;
1014
- sk -> sk_socket = parent ;
1019
+ sk_set_socket ( sk , parent ) ;
1015
1020
security_sock_graft (sk , parent );
1016
1021
write_unlock_bh (& sk -> sk_callback_lock );
1017
1022
}
Original file line number Diff line number Diff line change @@ -1066,7 +1066,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
1066
1066
* to be taken into account in all callers. -acme
1067
1067
*/
1068
1068
sk_refcnt_debug_inc (newsk );
1069
- newsk -> sk_socket = NULL ;
1069
+ sk_set_socket ( newsk , NULL ) ;
1070
1070
newsk -> sk_sleep = NULL ;
1071
1071
1072
1072
if (newsk -> sk_prot -> sockets_allocated )
@@ -1702,7 +1702,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1702
1702
sk -> sk_rcvbuf = sysctl_rmem_default ;
1703
1703
sk -> sk_sndbuf = sysctl_wmem_default ;
1704
1704
sk -> sk_state = TCP_CLOSE ;
1705
- sk -> sk_socket = sock ;
1705
+ sk_set_socket ( sk , sock ) ;
1706
1706
1707
1707
sock_set_flag (sk , SOCK_ZAPPED );
1708
1708
You can’t perform that action at this time.
0 commit comments