diff options
| author | Tejun Heo <tj@kernel.org> | 2015-12-07 10:09:03 -0500 | 
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2015-12-07 10:09:03 -0500 | 
| commit | 0b98f0c04245877ae0b625a7f0aa55b8ff98e0c4 (patch) | |
| tree | 486ebe0d76217a4f7781e28fbd96facb0b66f9da /net/ipv6/tcp_ipv6.c | |
| parent | 67cde9c4938945b9510730c64e68d2f1dd7bc0aa (diff) | |
| parent | 527e9316f8ec44bd53d90fb9f611fa7ffff52bb9 (diff) | |
Merge branch 'master' into for-4.4-fixes
The following commit which went into mainline through networking tree
  3b13758f51de ("cgroups: Allow dynamically changing net_classid")
conflicts in net/core/netclassid_cgroup.c with the following pending
fix in cgroup/for-4.4-fixes.
  1f7dd3e5a6e4 ("cgroup: fix handling of multi-destination migration from subtree_control enabling")
The former separates out update_classid() from cgrp_attach() and
updates it to walk all fds of all tasks in the target css so that it
can be used from both migration and config change paths.  The latter
drops @css from cgrp_attach().
Resolve the conflict by making cgrp_attach() call update_classid()
with the css from the first task.  We can revive @tset walking in
cgrp_attach() but given that net_cls is v1 only where there always is
only one target css during migration, this is fine.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Nina Schiff <ninasc@fb.com>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 51 | 
1 files changed, 34 insertions, 17 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 5baa8e754e41..e7aab561b7b4 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -120,6 +120,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	struct ipv6_pinfo *np = inet6_sk(sk);  	struct tcp_sock *tp = tcp_sk(sk);  	struct in6_addr *saddr = NULL, *final_p, final; +	struct ipv6_txoptions *opt;  	struct flowi6 fl6;  	struct dst_entry *dst;  	int addr_type; @@ -235,7 +236,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	fl6.fl6_dport = usin->sin6_port;  	fl6.fl6_sport = inet->inet_sport; -	final_p = fl6_update_dst(&fl6, np->opt, &final); +	opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); +	final_p = fl6_update_dst(&fl6, opt, &final);  	security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); @@ -255,7 +257,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  	inet->inet_rcv_saddr = LOOPBACK4_IPV6;  	sk->sk_gso_type = SKB_GSO_TCPV6; -	__ip6_dst_store(sk, dst, NULL, NULL); +	ip6_dst_store(sk, dst, NULL, NULL);  	if (tcp_death_row.sysctl_tw_recycle &&  	    !tp->rx_opt.ts_recent_stamp && @@ -263,9 +265,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,  		tcp_fetch_timewait_stamp(sk, dst);  	icsk->icsk_ext_hdr_len = 0; -	if (np->opt) -		icsk->icsk_ext_hdr_len = (np->opt->opt_flen + -					  np->opt->opt_nflen); +	if (opt) +		icsk->icsk_ext_hdr_len = opt->opt_flen + +					 opt->opt_nflen;  	tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); @@ -461,7 +463,8 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,  		if (np->repflow && ireq->pktopts)  			fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts)); -		err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass); +		err = ip6_xmit(sk, skb, fl6, rcu_dereference(np->opt), +			       np->tclass);  		err = net_xmit_eval(err);  	} @@ -972,6 +975,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *  	struct inet_request_sock *ireq;  	struct ipv6_pinfo *newnp;  	const struct ipv6_pinfo *np = inet6_sk(sk); +	struct ipv6_txoptions *opt;  	struct tcp6_sock *newtcp6sk;  	struct inet_sock *newinet;  	struct tcp_sock *newtp; @@ -1056,7 +1060,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *  	 */  	newsk->sk_gso_type = SKB_GSO_TCPV6; -	__ip6_dst_store(newsk, dst, NULL, NULL); +	ip6_dst_store(newsk, dst, NULL, NULL);  	inet6_sk_rx_dst_set(newsk, skb);  	newtcp6sk = (struct tcp6_sock *)newsk; @@ -1098,13 +1102,15 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *  	   but we make one more one thing there: reattach optmem  	   to newsk.  	 */ -	if (np->opt) -		newnp->opt = ipv6_dup_options(newsk, np->opt); - +	opt = rcu_dereference(np->opt); +	if (opt) { +		opt = ipv6_dup_options(newsk, opt); +		RCU_INIT_POINTER(newnp->opt, opt); +	}  	inet_csk(newsk)->icsk_ext_hdr_len = 0; -	if (newnp->opt) -		inet_csk(newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + -						     newnp->opt->opt_flen); +	if (opt) +		inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen + +						    opt->opt_flen;  	tcp_ca_openreq_child(newsk, dst); @@ -1690,6 +1696,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)  	const struct tcp_sock *tp = tcp_sk(sp);  	const struct inet_connection_sock *icsk = inet_csk(sp);  	const struct fastopen_queue *fastopenq = &icsk->icsk_accept_queue.fastopenq; +	int rx_queue; +	int state;  	dest  = &sp->sk_v6_daddr;  	src   = &sp->sk_v6_rcv_saddr; @@ -1710,6 +1718,15 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)  		timer_expires = jiffies;  	} +	state = sk_state_load(sp); +	if (state == TCP_LISTEN) +		rx_queue = sp->sk_ack_backlog; +	else +		/* Because we don't lock the socket, +		 * we might find a transient negative value. +		 */ +		rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); +  	seq_printf(seq,  		   "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "  		   "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %lu %lu %u %u %d\n", @@ -1718,9 +1735,9 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)  		   src->s6_addr32[2], src->s6_addr32[3], srcp,  		   dest->s6_addr32[0], dest->s6_addr32[1],  		   dest->s6_addr32[2], dest->s6_addr32[3], destp, -		   sp->sk_state, -		   tp->write_seq-tp->snd_una, -		   (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq), +		   state, +		   tp->write_seq - tp->snd_una, +		   rx_queue,  		   timer_active,  		   jiffies_delta_to_clock_t(timer_expires - jiffies),  		   icsk->icsk_retransmits, @@ -1732,7 +1749,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)  		   jiffies_to_clock_t(icsk->icsk_ack.ato),  		   (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,  		   tp->snd_cwnd, -		   sp->sk_state == TCP_LISTEN ? +		   state == TCP_LISTEN ?  			fastopenq->max_qlen :  			(tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh)  		   );  | 
