提交 1e2e6b89 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

[NET]: Move the get_net() from sock_copy()

The sock_copy() is supposed to just clone the socket. In a perfect
world it has to be just memcpy, but we have to handle the security
mark correctly. All the extra setup must be performed in sk_clone() 
call, so move the get_net() into more proper place.
Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f1a6c4da
...@@ -864,7 +864,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk) ...@@ -864,7 +864,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)
#endif #endif
memcpy(nsk, osk, osk->sk_prot->obj_size); memcpy(nsk, osk, osk->sk_prot->obj_size);
get_net(nsk->sk_net);
#ifdef CONFIG_SECURITY_NETWORK #ifdef CONFIG_SECURITY_NETWORK
nsk->sk_security = sptr; nsk->sk_security = sptr;
security_sk_clone(osk, nsk); security_sk_clone(osk, nsk);
...@@ -958,6 +957,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) ...@@ -958,6 +957,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
sock_copy(newsk, sk); sock_copy(newsk, sk);
/* SANITY */ /* SANITY */
get_net(newsk->sk_net);
sk_node_init(&newsk->sk_node); sk_node_init(&newsk->sk_node);
sock_lock_init(newsk); sock_lock_init(newsk);
bh_lock_sock(newsk); bh_lock_sock(newsk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册