提交 96241544 编写于 作者: R Rémi Denis-Courmont 提交者: David S. Miller

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

Signed-off-by: NRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b08cd667
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册