aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-04-19 13:43:52 +0200
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 01:40:37 -0300
commit7d5d775a55554183448b591a86b1d172ae993b94 (patch)
tree5fe2dfc616c8217026ccb52ceb4de0b968500bc0 /net
parentBluetooth: Split error handling for L2CAP listen sockets (diff)
downloadlinux-dev-7d5d775a55554183448b591a86b1d172ae993b94.tar.xz
linux-dev-7d5d775a55554183448b591a86b1d172ae993b94.zip
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: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/sco.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 7bd0947af2fa..a69aa345597e 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -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;