diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 17 | 
1 files changed, 12 insertions, 5 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a9db4b1a2215..337ba4cca052 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -73,6 +73,7 @@  #include <net/xfrm.h>  #include <net/netdma.h>  #include <net/secure_seq.h> +#include <net/tcp_memcontrol.h>  #include <linux/inet.h>  #include <linux/ipv6.h> @@ -630,7 +631,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)  	arg.iov[0].iov_len  = sizeof(rep.th);  #ifdef CONFIG_TCP_MD5SIG -	key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->daddr) : NULL; +	key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->saddr) : NULL;  	if (key) {  		rep.opt[0] = htonl((TCPOPT_NOP << 24) |  				   (TCPOPT_NOP << 16) | @@ -1511,6 +1512,7 @@ exit:  	return NULL;  put_and_exit:  	tcp_clear_xmit_timers(newsk); +	tcp_cleanup_congestion_control(newsk);  	bh_unlock_sock(newsk);  	sock_put(newsk);  	goto exit; @@ -1916,7 +1918,8 @@ static int tcp_v4_init_sock(struct sock *sk)  	sk->sk_rcvbuf = sysctl_tcp_rmem[1];  	local_bh_disable(); -	percpu_counter_inc(&tcp_sockets_allocated); +	sock_update_memcg(sk); +	sk_sockets_allocated_inc(sk);  	local_bh_enable();  	return 0; @@ -1972,7 +1975,8 @@ void tcp_v4_destroy_sock(struct sock *sk)  		tp->cookie_values = NULL;  	} -	percpu_counter_dec(&tcp_sockets_allocated); +	sk_sockets_allocated_dec(sk); +	sock_release_memcg(sk);  }  EXPORT_SYMBOL(tcp_v4_destroy_sock); @@ -2619,7 +2623,6 @@ struct proto tcp_prot = {  	.orphan_count		= &tcp_orphan_count,  	.memory_allocated	= &tcp_memory_allocated,  	.memory_pressure	= &tcp_memory_pressure, -	.sysctl_mem		= sysctl_tcp_mem,  	.sysctl_wmem		= sysctl_tcp_wmem,  	.sysctl_rmem		= sysctl_tcp_rmem,  	.max_header		= MAX_TCP_HEADER, @@ -2633,10 +2636,14 @@ struct proto tcp_prot = {  	.compat_setsockopt	= compat_tcp_setsockopt,  	.compat_getsockopt	= compat_tcp_getsockopt,  #endif +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM +	.init_cgroup		= tcp_init_cgroup, +	.destroy_cgroup		= tcp_destroy_cgroup, +	.proto_cgroup		= tcp_proto_cgroup, +#endif  };  EXPORT_SYMBOL(tcp_prot); -  static int __net_init tcp_sk_init(struct net *net)  {  	return inet_ctl_sock_create(&net->ipv4.tcp_sock,  |