aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 5c965ecc96a0..ca03a1dcbc8f 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -475,6 +475,7 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
475 } 475 }
476 spin_unlock_bh(&queue->fastopenq.lock); 476 spin_unlock_bh(&queue->fastopenq.lock);
477 } 477 }
478 mem_cgroup_sk_alloc(newsk);
478out: 479out:
479 release_sock(sk); 480 release_sock(sk);
480 if (req) 481 if (req)
@@ -537,9 +538,10 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk,
537{ 538{
538 const struct inet_request_sock *ireq = inet_rsk(req); 539 const struct inet_request_sock *ireq = inet_rsk(req);
539 struct net *net = read_pnet(&ireq->ireq_net); 540 struct net *net = read_pnet(&ireq->ireq_net);
540 struct ip_options_rcu *opt = ireq->opt; 541 struct ip_options_rcu *opt;
541 struct rtable *rt; 542 struct rtable *rt;
542 543
544 opt = rcu_dereference(ireq->ireq_opt);
543 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, 545 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark,
544 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, 546 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
545 sk->sk_protocol, inet_sk_flowi_flags(sk), 547 sk->sk_protocol, inet_sk_flowi_flags(sk),
@@ -573,10 +575,9 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
573 struct flowi4 *fl4; 575 struct flowi4 *fl4;
574 struct rtable *rt; 576 struct rtable *rt;
575 577
578 opt = rcu_dereference(ireq->ireq_opt);
576 fl4 = &newinet->cork.fl.u.ip4; 579 fl4 = &newinet->cork.fl.u.ip4;
577 580
578 rcu_read_lock();
579 opt = rcu_dereference(newinet->inet_opt);
580 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, 581 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark,
581 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, 582 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
582 sk->sk_protocol, inet_sk_flowi_flags(sk), 583 sk->sk_protocol, inet_sk_flowi_flags(sk),
@@ -589,13 +590,11 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
589 goto no_route; 590 goto no_route;
590 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) 591 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway)
591 goto route_err; 592 goto route_err;
592 rcu_read_unlock();
593 return &rt->dst; 593 return &rt->dst;
594 594
595route_err: 595route_err:
596 ip_rt_put(rt); 596 ip_rt_put(rt);
597no_route: 597no_route:
598 rcu_read_unlock();
599 __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); 598 __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES);
600 return NULL; 599 return NULL;
601} 600}