diff options
Diffstat (limited to 'net/phonet/socket.c')
-rw-r--r-- | net/phonet/socket.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index 25f746d20c1f..ceb5143f5ef9 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c | |||
@@ -428,19 +428,19 @@ static int pn_socket_listen(struct socket *sock, int backlog) | |||
428 | struct sock *sk = sock->sk; | 428 | struct sock *sk = sock->sk; |
429 | int err = 0; | 429 | int err = 0; |
430 | 430 | ||
431 | if (sock->state != SS_UNCONNECTED) | ||
432 | return -EINVAL; | ||
433 | if (pn_socket_autobind(sock)) | 431 | if (pn_socket_autobind(sock)) |
434 | return -ENOBUFS; | 432 | return -ENOBUFS; |
435 | 433 | ||
436 | lock_sock(sk); | 434 | lock_sock(sk); |
437 | if (sk->sk_state != TCP_CLOSE) { | 435 | if (sock->state != SS_UNCONNECTED) { |
438 | err = -EINVAL; | 436 | err = -EINVAL; |
439 | goto out; | 437 | goto out; |
440 | } | 438 | } |
441 | 439 | ||
442 | sk->sk_state = TCP_LISTEN; | 440 | if (sk->sk_state != TCP_LISTEN) { |
443 | sk->sk_ack_backlog = 0; | 441 | sk->sk_state = TCP_LISTEN; |
442 | sk->sk_ack_backlog = 0; | ||
443 | } | ||
444 | sk->sk_max_ack_backlog = backlog; | 444 | sk->sk_max_ack_backlog = backlog; |
445 | out: | 445 | out: |
446 | release_sock(sk); | 446 | release_sock(sk); |