From: Gustavo F. Padovan Date: Thu, 23 Dec 2010 01:00:34 +0000 (-0200) Subject: Bluetooth: Improve handling of HCI control channel in bind X-Git-Tag: v2.6.38-rc1~476^2~14^2~3^2~43^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17f9cc3124c97f50a19a7597e5f29f915b5b835c;p=platform%2Fkernel%2Flinux-3.10.git 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 --- diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index f6c18ab..29827c7 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);