Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347296
b: refs/heads/master
c: e337e24
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Paasch authored and David S. Miller committed Dec 14, 2012
1 parent 84ebe67 commit 734998d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 093d04d42fa094f6740bb188f0ad0c215ff61e2c
refs/heads/master: e337e24d6624e74a558aa69071e112a65f7b5758
1 change: 1 addition & 0 deletions trunk/include/net/inet_connection_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ extern void inet_csk_reqsk_queue_prune(struct sock *parent,
const unsigned long max_rto);

extern void inet_csk_destroy_sock(struct sock *sk);
extern void inet_csk_prepare_forced_close(struct sock *sk);

/*
* LISTEN is a special case for poll..
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/dccp/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
return NULL;
put_and_exit:
bh_unlock_sock(newsk);
sock_put(newsk);
inet_csk_prepare_forced_close(newsk);
dccp_done(newsk);
goto exit;
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/net/dccp/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
newinet->inet_rcv_saddr = LOOPBACK4_IPV6;

if (__inet_inherit_port(sk, newsk) < 0) {
sock_put(newsk);
inet_csk_prepare_forced_close(newsk);
dccp_done(newsk);
goto out;
}
__inet6_hash(newsk, NULL);
Expand Down
16 changes: 16 additions & 0 deletions trunk/net/ipv4/inet_connection_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,22 @@ void inet_csk_destroy_sock(struct sock *sk)
}
EXPORT_SYMBOL(inet_csk_destroy_sock);

/* This function allows to force a closure of a socket after the call to
* tcp/dccp_create_openreq_child().
*/
void inet_csk_prepare_forced_close(struct sock *sk)
{
/* sk_clone_lock locked the socket and set refcnt to 2 */
bh_unlock_sock(sk);
sock_put(sk);

/* The below has to be done to allow calling inet_csk_destroy_sock */
sock_set_flag(sk, SOCK_DEAD);
percpu_counter_inc(sk->sk_prot->orphan_count);
inet_sk(sk)->inet_num = 0;
}
EXPORT_SYMBOL(inet_csk_prepare_forced_close);

int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
{
struct inet_sock *inet = inet_sk(sk);
Expand Down
6 changes: 2 additions & 4 deletions trunk/net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1767,10 +1767,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
return NULL;
put_and_exit:
tcp_clear_xmit_timers(newsk);
tcp_cleanup_congestion_control(newsk);
bh_unlock_sock(newsk);
sock_put(newsk);
inet_csk_prepare_forced_close(newsk);
tcp_done(newsk);
goto exit;
}
EXPORT_SYMBOL(tcp_v4_syn_recv_sock);
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
#endif

if (__inet_inherit_port(sk, newsk) < 0) {
sock_put(newsk);
inet_csk_prepare_forced_close(newsk);
tcp_done(newsk);
goto out;
}
__inet6_hash(newsk, NULL);
Expand Down

0 comments on commit 734998d

Please sign in to comment.