summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-12-23 02:00:34 +0100
committerGustavo F. Padovan <padovan@profusion.mobi>2010-12-23 02:00:34 +0100
commit17f9cc3124c97f50a19a7597e5f29f915b5b835c (patch)
treef86d9d088a8ee73e94ff353526064cf58eeaf3eb /net/bluetooth
parentBluetooth: Fix __hci_request synchronization for hci_open_dev (diff)
downloadlinux-17f9cc3124c97f50a19a7597e5f29f915b5b835c.tar.xz
linux-17f9cc3124c97f50a19a7597e5f29f915b5b835c.zip
Bluetooth: Improve handling of HCI control channel in bind
Does not allow any channel different of HCI_CHANNEL_RAW and HCI_CHANNEL_CONTROL to bind. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_sock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index f6c18abab797..29827c77f6ce 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -380,7 +380,10 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
if (haddr.hci_family != AF_BLUETOOTH)
return -EINVAL;
- if (haddr.hci_channel != HCI_CHANNEL_RAW && !enable_mgmt)
+ if (haddr.hci_channel > HCI_CHANNEL_CONTROL)
+ return -EINVAL;
+
+ if (haddr.hci_channel == HCI_CHANNEL_CONTROL && !enable_mgmt)
return -EINVAL;
lock_sock(sk);