summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-04-19 13:43:51 +0200
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 01:40:37 -0300
commit6b3af7334bd3c403647606adfb04f6e6bcf1597e (patch)
tree5e4569e2e9c4e97735f7fdb5e1d24d02d9c5af10 /net/bluetooth/l2cap_sock.c
parent35d4adcca1707c551f4598f68fe83118dd82cd60 (diff)
downloadblackbird-op-linux-6b3af7334bd3c403647606adfb04f6e6bcf1597e.tar.gz
blackbird-op-linux-6b3af7334bd3c403647606adfb04f6e6bcf1597e.zip
Bluetooth: Split error handling for L2CAP listen sockets
Split the checks for sk->sk_state and sk->sk_type for L2CAP 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/bluetooth/l2cap_sock.c')
-rw-r--r--net/bluetooth/l2cap_sock.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 46126cbc9de4..8d8b50a29906 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -148,12 +148,16 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
lock_sock(sk);
- if ((sock->type != SOCK_SEQPACKET && sock->type != SOCK_STREAM)
- || sk->sk_state != BT_BOUND) {
+ if (sk->sk_state != BT_BOUND) {
err = -EBADFD;
goto done;
}
+ if (sk->sk_type != SOCK_SEQPACKET && sk->sk_type != SOCK_STREAM) {
+ err = -EINVAL;
+ goto done;
+ }
+
switch (chan->mode) {
case L2CAP_MODE_BASIC:
break;
OpenPOWER on IntegriCloud