From 61e617c217fefc09d87bf53564d2388c07e58ad4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 17 Jun 2008 22:41:38 -0700 Subject: [PATCH] --- yaml --- r: 103063 b: refs/heads/master c: 972692e0db9b0a62329ca394062b58917ddbd03c h: refs/heads/master i: 103061: d915e0d653013a63f15209afe52959ddca16b400 103059: 8777a67fddb64df8dcbd77b02eece2b5214334b3 103055: be111f74ff175245752f85de464f08d45f67dbc0 v: v3 --- [refs] | 2 +- trunk/include/net/sock.h | 9 +++++++-- trunk/net/core/sock.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index df5110ae8e72..524b0e50efd0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5bbc1722d52ad3df062d5742a7e958276e57ebd7 +refs/heads/master: 972692e0db9b0a62329ca394062b58917ddbd03c diff --git a/trunk/include/net/sock.h b/trunk/include/net/sock.h index a7c30412de66..3f4897ab432e 100644 --- a/trunk/include/net/sock.h +++ b/trunk/include/net/sock.h @@ -990,6 +990,11 @@ static inline void sock_put(struct sock *sk) extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested); +static inline void sk_set_socket(struct sock *sk, struct socket *sock) +{ + sk->sk_socket = sock; +} + /* Detach socket from process context. * Announce socket dead, detach it from wait queue and inode. * Note that parent inode held reference count on this struct sock, @@ -1001,7 +1006,7 @@ static inline void sock_orphan(struct sock *sk) { write_lock_bh(&sk->sk_callback_lock); sock_set_flag(sk, SOCK_DEAD); - sk->sk_socket = NULL; + sk_set_socket(sk, NULL); sk->sk_sleep = NULL; write_unlock_bh(&sk->sk_callback_lock); } @@ -1011,7 +1016,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) write_lock_bh(&sk->sk_callback_lock); sk->sk_sleep = &parent->wait; parent->sk = sk; - sk->sk_socket = parent; + sk_set_socket(sk, parent); security_sock_graft(sk, parent); write_unlock_bh(&sk->sk_callback_lock); } diff --git a/trunk/net/core/sock.c b/trunk/net/core/sock.c index 3879bf65897e..2c0ba52e5303 100644 --- a/trunk/net/core/sock.c +++ b/trunk/net/core/sock.c @@ -1066,7 +1066,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) * to be taken into account in all callers. -acme */ sk_refcnt_debug_inc(newsk); - newsk->sk_socket = NULL; + sk_set_socket(newsk, NULL); newsk->sk_sleep = NULL; if (newsk->sk_prot->sockets_allocated) @@ -1702,7 +1702,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_sndbuf = sysctl_wmem_default; sk->sk_state = TCP_CLOSE; - sk->sk_socket = sock; + sk_set_socket(sk, sock); sock_set_flag(sk, SOCK_ZAPPED);