dect
/
linux-2.6
Archived
13
0
Fork 0

Phonet: allow multiple listen() and fix small race condition

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rémi Denis-Courmont 2011-02-24 23:14:56 +00:00 committed by David S. Miller
parent b08cd667c4
commit 96241544ca
1 changed files with 5 additions and 5 deletions

View File

@ -428,19 +428,19 @@ static int pn_socket_listen(struct socket *sock, int backlog)
struct sock *sk = sock->sk;
int err = 0;
if (sock->state != SS_UNCONNECTED)
return -EINVAL;
if (pn_socket_autobind(sock))
return -ENOBUFS;
lock_sock(sk);
if (sk->sk_state != TCP_CLOSE) {
if (sock->state != SS_UNCONNECTED) {
err = -EINVAL;
goto out;
}
sk->sk_state = TCP_LISTEN;
sk->sk_ack_backlog = 0;
if (sk->sk_state != TCP_LISTEN) {
sk->sk_state = TCP_LISTEN;
sk->sk_ack_backlog = 0;
}
sk->sk_max_ack_backlog = backlog;
out:
release_sock(sk);