]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/core/sock.c
Merge tag 'usercopy-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[linux.git] / net / core / sock.c
index 1033f8ab05470b9fe8fd2be5d0b431faf44ed6d1..b026e1717df4e5b58186b07b3225820fe9eb66cb 100644 (file)
@@ -1683,16 +1683,13 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
                newsk->sk_dst_pending_confirm = 0;
                newsk->sk_wmem_queued   = 0;
                newsk->sk_forward_alloc = 0;
-
-               /* sk->sk_memcg will be populated at accept() time */
-               newsk->sk_memcg = NULL;
-
                atomic_set(&newsk->sk_drops, 0);
                newsk->sk_send_head     = NULL;
                newsk->sk_userlocks     = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK;
                atomic_set(&newsk->sk_zckey, 0);
 
                sock_reset_flag(newsk, SOCK_DONE);
+               mem_cgroup_sk_alloc(newsk);
                cgroup_sk_alloc(&newsk->sk_cgrp_data);
 
                rcu_read_lock();
@@ -3194,8 +3191,10 @@ static int req_prot_init(const struct proto *prot)
 int proto_register(struct proto *prot, int alloc_slab)
 {
        if (alloc_slab) {
-               prot->slab = kmem_cache_create(prot->name, prot->obj_size, 0,
+               prot->slab = kmem_cache_create_usercopy(prot->name,
+                                       prot->obj_size, 0,
                                        SLAB_HWCACHE_ALIGN | prot->slab_flags,
+                                       prot->useroffset, prot->usersize,
                                        NULL);
 
                if (prot->slab == NULL) {