diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2014-06-29 06:13:05 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:49 -0400 |
commit | fee746b0babf128a50ece050ee6e63003ebb5ae1 (patch) | |
tree | 4a3c3b7ca76f43ddda0f85b006c023e298d1c3ed /net/bluetooth/mgmt.c | |
parent | 958684263d3efbc721fb2b86f94876893eb638d2 (diff) |
Bluetooth: Restrict access for raw-only controllers
Bluetooth controllers that are marked for raw-only usage can only be
used with user channel access. Any other operation should be rejected.
This simplifies the whole raw-only support since it now depends on
the fact that the controller is marked with HCI_QUIRK_RAW_DEVICE and
runtime raw access is restricted to user channel operation.
The kernel internal processing of HCI commands and events is designed
around the case that either the kernel has full control over the device
or that the device is driven from userspace. This now makes a clear
distinction between these two possible operation modes.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 6faa4616cbfe..41b1aec0c5dc 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -347,6 +347,9 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, | |||
347 | if (test_bit(HCI_USER_CHANNEL, &d->dev_flags)) | 347 | if (test_bit(HCI_USER_CHANNEL, &d->dev_flags)) |
348 | continue; | 348 | continue; |
349 | 349 | ||
350 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &d->quirks)) | ||
351 | continue; | ||
352 | |||
350 | if (d->dev_type == HCI_BREDR) { | 353 | if (d->dev_type == HCI_BREDR) { |
351 | rp->index[count++] = cpu_to_le16(d->id); | 354 | rp->index[count++] = cpu_to_le16(d->id); |
352 | BT_DBG("Added hci%u", d->id); | 355 | BT_DBG("Added hci%u", d->id); |
@@ -5066,7 +5069,8 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) | |||
5066 | } | 5069 | } |
5067 | 5070 | ||
5068 | if (test_bit(HCI_SETUP, &hdev->dev_flags) || | 5071 | if (test_bit(HCI_SETUP, &hdev->dev_flags) || |
5069 | test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) { | 5072 | test_bit(HCI_USER_CHANNEL, &hdev->dev_flags) || |
5073 | test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) { | ||
5070 | err = cmd_status(sk, index, opcode, | 5074 | err = cmd_status(sk, index, opcode, |
5071 | MGMT_STATUS_INVALID_INDEX); | 5075 | MGMT_STATUS_INVALID_INDEX); |
5072 | goto done; | 5076 | goto done; |