diff options
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index c039c937ba90..5ec9136a7c36 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); | ||
478 | out: | 479 | out: |
479 | release_sock(sk); | 480 | release_sock(sk); |
480 | if (req) | 481 | if (req) |
@@ -539,9 +540,10 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, | |||
539 | { | 540 | { |
540 | const struct inet_request_sock *ireq = inet_rsk(req); | 541 | const struct inet_request_sock *ireq = inet_rsk(req); |
541 | struct net *net = read_pnet(&ireq->ireq_net); | 542 | struct net *net = read_pnet(&ireq->ireq_net); |
542 | struct ip_options_rcu *opt = ireq->opt; | 543 | struct ip_options_rcu *opt; |
543 | struct rtable *rt; | 544 | struct rtable *rt; |
544 | 545 | ||
546 | opt = rcu_dereference(ireq->ireq_opt); | ||
545 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, | 547 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
546 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 548 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
547 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 549 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
@@ -575,10 +577,9 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, | |||
575 | struct flowi4 *fl4; | 577 | struct flowi4 *fl4; |
576 | struct rtable *rt; | 578 | struct rtable *rt; |
577 | 579 | ||
580 | opt = rcu_dereference(ireq->ireq_opt); | ||
578 | fl4 = &newinet->cork.fl.u.ip4; | 581 | fl4 = &newinet->cork.fl.u.ip4; |
579 | 582 | ||
580 | rcu_read_lock(); | ||
581 | opt = rcu_dereference(newinet->inet_opt); | ||
582 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, | 583 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
583 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 584 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
584 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 585 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
@@ -591,13 +592,11 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, | |||
591 | goto no_route; | 592 | goto no_route; |
592 | if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) | 593 | if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) |
593 | goto route_err; | 594 | goto route_err; |
594 | rcu_read_unlock(); | ||
595 | return &rt->dst; | 595 | return &rt->dst; |
596 | 596 | ||
597 | route_err: | 597 | route_err: |
598 | ip_rt_put(rt); | 598 | ip_rt_put(rt); |
599 | no_route: | 599 | no_route: |
600 | rcu_read_unlock(); | ||
601 | __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); | 600 | __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
602 | return NULL; | 601 | return NULL; |
603 | } | 602 | } |