aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
commit1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch)
tree47da3feee8e263e8c9352c85cf518e624be3c211 /net/core/sock.c
parent750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff)
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff)
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 9b7b6bbb2a23..23953b741a41 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1654,6 +1654,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1654 1654
1655 sock_copy(newsk, sk); 1655 sock_copy(newsk, sk);
1656 1656
1657 newsk->sk_prot_creator = sk->sk_prot;
1658
1657 /* SANITY */ 1659 /* SANITY */
1658 if (likely(newsk->sk_net_refcnt)) 1660 if (likely(newsk->sk_net_refcnt))
1659 get_net(sock_net(newsk)); 1661 get_net(sock_net(newsk));
@@ -1682,13 +1684,16 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
1682 1684
1683 sock_reset_flag(newsk, SOCK_DONE); 1685 sock_reset_flag(newsk, SOCK_DONE);
1684 1686
1685 filter = rcu_dereference_protected(newsk->sk_filter, 1); 1687 rcu_read_lock();
1688 filter = rcu_dereference(sk->sk_filter);
1686 if (filter != NULL) 1689 if (filter != NULL)
1687 /* though it's an empty new sock, the charging may fail 1690 /* though it's an empty new sock, the charging may fail
1688 * if sysctl_optmem_max was changed between creation of 1691 * if sysctl_optmem_max was changed between creation of
1689 * original socket and cloning 1692 * original socket and cloning
1690 */ 1693 */
1691 is_charged = sk_filter_charge(newsk, filter); 1694 is_charged = sk_filter_charge(newsk, filter);
1695 RCU_INIT_POINTER(newsk->sk_filter, filter);
1696 rcu_read_unlock();
1692 1697
1693 if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { 1698 if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) {
1694 /* We need to make sure that we don't uncharge the new 1699 /* We need to make sure that we don't uncharge the new