aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2016-07-06 20:15:34 -0400
committerJames Morris <james.l.morris@oracle.com>2016-07-06 20:15:34 -0400
commitd011a4d861ce583466a8ae72a0c8e7f51c8cba4e (patch)
tree1ff8dfe7d486f5648e69ee85e54cde1987d8296a /net/ipv6/tcp_ipv6.c
parent544e1cea03e6674e3c12a3b8e8cc507c3dbeaf0c (diff)
parent3f09354ac84c6904787189d85fb306bf60f714b8 (diff)
Merge branch 'stable-4.8' of git://git.infradead.org/users/pcmoore/selinux into next
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 79e33e02f11a..818b3b5cd490 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -443,6 +443,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
443{ 443{
444 struct inet_request_sock *ireq = inet_rsk(req); 444 struct inet_request_sock *ireq = inet_rsk(req);
445 struct ipv6_pinfo *np = inet6_sk(sk); 445 struct ipv6_pinfo *np = inet6_sk(sk);
446 struct ipv6_txoptions *opt;
446 struct flowi6 *fl6 = &fl->u.ip6; 447 struct flowi6 *fl6 = &fl->u.ip6;
447 struct sk_buff *skb; 448 struct sk_buff *skb;
448 int err = -ENOMEM; 449 int err = -ENOMEM;
@@ -463,8 +464,10 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
463 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts)); 464 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts));
464 465
465 rcu_read_lock(); 466 rcu_read_lock();
466 err = ip6_xmit(sk, skb, fl6, rcu_dereference(np->opt), 467 opt = ireq->ipv6_opt;
467 np->tclass); 468 if (!opt)
469 opt = rcu_dereference(np->opt);
470 err = ip6_xmit(sk, skb, fl6, opt, np->tclass);
468 rcu_read_unlock(); 471 rcu_read_unlock();
469 err = net_xmit_eval(err); 472 err = net_xmit_eval(err);
470 } 473 }
@@ -476,6 +479,7 @@ done:
476 479
477static void tcp_v6_reqsk_destructor(struct request_sock *req) 480static void tcp_v6_reqsk_destructor(struct request_sock *req)
478{ 481{
482 kfree(inet_rsk(req)->ipv6_opt);
479 kfree_skb(inet_rsk(req)->pktopts); 483 kfree_skb(inet_rsk(req)->pktopts);
480} 484}
481 485
@@ -1109,7 +1113,9 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
1109 but we make one more one thing there: reattach optmem 1113 but we make one more one thing there: reattach optmem
1110 to newsk. 1114 to newsk.
1111 */ 1115 */
1112 opt = rcu_dereference(np->opt); 1116 opt = ireq->ipv6_opt;
1117 if (!opt)
1118 opt = rcu_dereference(np->opt);
1113 if (opt) { 1119 if (opt) {
1114 opt = ipv6_dup_options(newsk, opt); 1120 opt = ipv6_dup_options(newsk, opt);
1115 RCU_INIT_POINTER(newnp->opt, opt); 1121 RCU_INIT_POINTER(newnp->opt, opt);