Skip to content

Commit

Permalink
Bluetooth: Split error handling for SCO listen sockets
Browse files Browse the repository at this point in the history
Split the checks for sk->sk_state and sk->sk_type for SCO listen
sockets. This makes the code more readable.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
  • Loading branch information
Marcel Holtmann authored and Gustavo Padovan committed May 9, 2012
1 parent 6b3af73 commit 7d5d775
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,16 @@ static int sco_sock_listen(struct socket *sock, int backlog)

lock_sock(sk);

if (sk->sk_state != BT_BOUND || sock->type != SOCK_SEQPACKET) {
if (sk->sk_state != BT_BOUND) {
err = -EBADFD;
goto done;
}

if (sk->sk_type != SOCK_SEQPACKET) {
err = -EINVAL;
goto done;
}

sk->sk_max_ack_backlog = backlog;
sk->sk_ack_backlog = 0;
sk->sk_state = BT_LISTEN;
Expand Down

0 comments on commit 7d5d775

Please sign in to comment.