Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d5d775a authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Gustavo Padovan
Browse files

Bluetooth: Split error handling for SCO listen sockets



Split the checks for sk->sk_state and sk->sk_type for SCO listen
sockets. This makes the code more readable.

Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo Padovan <gustavo@padovan.org>
parent 6b3af733
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;