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.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index bd1278a2d828..c7cda1ca8e65 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -109,7 +109,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
109 hashinfo->bhash_size)]; 109 hashinfo->bhash_size)];
110 spin_lock(&head->lock); 110 spin_lock(&head->lock);
111 inet_bind_bucket_for_each(tb, node, &head->chain) 111 inet_bind_bucket_for_each(tb, node, &head->chain)
112 if (tb->ib_net == net && tb->port == rover) 112 if (ib_net(tb) == net && tb->port == rover)
113 goto next; 113 goto next;
114 break; 114 break;
115 next: 115 next:
@@ -137,7 +137,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
137 hashinfo->bhash_size)]; 137 hashinfo->bhash_size)];
138 spin_lock(&head->lock); 138 spin_lock(&head->lock);
139 inet_bind_bucket_for_each(tb, node, &head->chain) 139 inet_bind_bucket_for_each(tb, node, &head->chain)
140 if (tb->ib_net == net && tb->port == snum) 140 if (ib_net(tb) == net && tb->port == snum)
141 goto tb_found; 141 goto tb_found;
142 } 142 }
143 tb = NULL; 143 tb = NULL;
@@ -323,7 +323,7 @@ void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len)
323 323
324EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); 324EXPORT_SYMBOL(inet_csk_reset_keepalive_timer);
325 325
326struct dst_entry* inet_csk_route_req(struct sock *sk, 326struct dst_entry *inet_csk_route_req(struct sock *sk,
327 const struct request_sock *req) 327 const struct request_sock *req)
328{ 328{
329 struct rtable *rt; 329 struct rtable *rt;
@@ -344,16 +344,17 @@ struct dst_entry* inet_csk_route_req(struct sock *sk,
344 struct net *net = sock_net(sk); 344 struct net *net = sock_net(sk);
345 345
346 security_req_classify_flow(req, &fl); 346 security_req_classify_flow(req, &fl);
347 if (ip_route_output_flow(net, &rt, &fl, sk, 0)) { 347 if (ip_route_output_flow(net, &rt, &fl, sk, 0))
348 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); 348 goto no_route;
349 return NULL; 349 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway)
350 } 350 goto route_err;
351 if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) {
352 ip_rt_put(rt);
353 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
354 return NULL;
355 }
356 return &rt->u.dst; 351 return &rt->u.dst;
352
353route_err:
354 ip_rt_put(rt);
355no_route:
356 IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES);
357 return NULL;
357} 358}
358 359
359EXPORT_SYMBOL_GPL(inet_csk_route_req); 360EXPORT_SYMBOL_GPL(inet_csk_route_req);
@@ -561,7 +562,7 @@ void inet_csk_destroy_sock(struct sock *sk)
561 562
562 sk_refcnt_debug_release(sk); 563 sk_refcnt_debug_release(sk);
563 564
564 atomic_dec(sk->sk_prot->orphan_count); 565 percpu_counter_dec(sk->sk_prot->orphan_count);
565 sock_put(sk); 566 sock_put(sk);
566} 567}
567 568
@@ -632,6 +633,8 @@ void inet_csk_listen_stop(struct sock *sk)
632 633
633 acc_req = req->dl_next; 634 acc_req = req->dl_next;
634 635
636 percpu_counter_inc(sk->sk_prot->orphan_count);
637
635 local_bh_disable(); 638 local_bh_disable();
636 bh_lock_sock(child); 639 bh_lock_sock(child);
637 WARN_ON(sock_owned_by_user(child)); 640 WARN_ON(sock_owned_by_user(child));
@@ -641,8 +644,6 @@ void inet_csk_listen_stop(struct sock *sk)
641 644
642 sock_orphan(child); 645 sock_orphan(child);
643 646
644 atomic_inc(sk->sk_prot->orphan_count);
645
646 inet_csk_destroy_sock(child); 647 inet_csk_destroy_sock(child);
647 648
648 bh_unlock_sock(child); 649 bh_unlock_sock(child);