mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-19 06:47:48 +00:00
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:
parent
b08cd667c4
commit
96241544ca
@ -428,19 +428,19 @@ static int pn_socket_listen(struct socket *sock, int backlog)
|
|||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (sock->state != SS_UNCONNECTED)
|
|
||||||
return -EINVAL;
|
|
||||||
if (pn_socket_autobind(sock))
|
if (pn_socket_autobind(sock))
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
|
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
if (sk->sk_state != TCP_CLOSE) {
|
if (sock->state != SS_UNCONNECTED) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk->sk_state = TCP_LISTEN;
|
if (sk->sk_state != TCP_LISTEN) {
|
||||||
sk->sk_ack_backlog = 0;
|
sk->sk_state = TCP_LISTEN;
|
||||||
|
sk->sk_ack_backlog = 0;
|
||||||
|
}
|
||||||
sk->sk_max_ack_backlog = backlog;
|
sk->sk_max_ack_backlog = backlog;
|
||||||
out:
|
out:
|
||||||
release_sock(sk);
|
release_sock(sk);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user