Skip to contentSkip to conversation

Bluetooth: Split error handling for SCO listen sockets

PATCH Applied Marcel Holtmann 2 participants 2 messages Apr 19, 2012

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 2/3 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.

---
 net/bluetooth/sco.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
net/bluetooth/sco.c +6 -1
index 32c0e31..2fb9636 100644
@@ -540,11 +540,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;
Signature · 1 line
1.7.7.6
#1 lore raw

Hi Marcel,

Quoted 7 lines · Marcel Holtmann

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

---
 net/bluetooth/sco.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Applied to bluetooth-next, thanks.

Gustavo