Skip to content

Commit

Permalink
Bluetooth: Check SOL_HCI for raw socket options
Browse files Browse the repository at this point in the history
The SOL_HCI level should be enforced when using socket options on the
HCI raw socket interface.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann committed Sep 19, 2016
1 parent 7e85245 commit 47b0f57
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,9 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,

BT_DBG("sk %p, opt %d", sk, optname);

if (level != SOL_HCI)
return -ENOPROTOOPT;

lock_sock(sk);

if (hci_pi(sk)->channel != HCI_CHANNEL_RAW) {
Expand Down Expand Up @@ -1523,6 +1526,9 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname,

BT_DBG("sk %p, opt %d", sk, optname);

if (level != SOL_HCI)
return -ENOPROTOOPT;

if (get_user(len, optlen))
return -EFAULT;

Expand Down

0 comments on commit 47b0f57

Please sign in to comment.