summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-15 03:28:03 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-15 08:58:56 +0100
commitc927a10487477eeed0441e5c88147700e69e5db9 (patch)
tree3b5b4cf14ad95ef992e08930105ec707619050bc /net
parentBluetooth: Remove unneeded initializer for management command table (diff)
downloadlinux-c927a10487477eeed0441e5c88147700e69e5db9.tar.xz
linux-c927a10487477eeed0441e5c88147700e69e5db9.zip
Bluetooth: Add support for trust verification of management commands
Check the required trust level of each management command with the trust level of the management socket. If it does not match up, then return the newly introduced permission denied error. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2162f7bc89be..920acf0625f6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6379,6 +6379,13 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
handler = &chan->handlers[opcode];
+ if (!hci_sock_test_flag(sk, HCI_SOCK_TRUSTED) &&
+ !(handler->flags & HCI_MGMT_UNTRUSTED)) {
+ err = mgmt_cmd_status(sk, index, opcode,
+ MGMT_STATUS_PERMISSION_DENIED);
+ goto done;
+ }
+
if (index != MGMT_INDEX_NONE) {
hdev = hci_dev_get(index);
if (!hdev) {