net: tcp_memcontrol: sanitize tcp memory accounting callbacks
[cascardo/linux.git] / net / ipv4 / tcp_output.c
index 412a920..493b489 100644 (file)
@@ -2813,13 +2813,16 @@ begin_fwd:
  */
 void sk_forced_mem_schedule(struct sock *sk, int size)
 {
-       int amt, status;
+       int amt;
 
        if (size <= sk->sk_forward_alloc)
                return;
        amt = sk_mem_pages(size);
        sk->sk_forward_alloc += amt * SK_MEM_QUANTUM;
-       sk_memory_allocated_add(sk, amt, &status);
+       sk_memory_allocated_add(sk, amt);
+
+       if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
+               mem_cgroup_charge_skmem(sk->sk_cgrp, amt);
 }
 
 /* Send a FIN. The caller locks the socket for us.