aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/inet_connection_sock.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 65a3b2565102..d545fb99a8a1 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -483,27 +483,27 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
spin_unlock_bh(&queue->fastopenq.lock);
}
- if (mem_cgroup_sockets_enabled) {
+out:
+ release_sock(sk);
+ if (newsk && mem_cgroup_sockets_enabled) {
int amt;
/* atomically get the memory usage, set and charge the
- * sk->sk_memcg.
+ * newsk->sk_memcg.
*/
lock_sock(newsk);
- /* The sk has not been accepted yet, no need to look at
- * sk->sk_wmem_queued.
+ /* The socket has not been accepted yet, no need to look at
+ * newsk->sk_wmem_queued.
*/
amt = sk_mem_pages(newsk->sk_forward_alloc +
- atomic_read(&sk->sk_rmem_alloc));
+ atomic_read(&newsk->sk_rmem_alloc));
mem_cgroup_sk_alloc(newsk);
if (newsk->sk_memcg && amt)
mem_cgroup_charge_skmem(newsk->sk_memcg, amt);
release_sock(newsk);
}
-out:
- release_sock(sk);
if (req)
reqsk_put(req);
return newsk;