aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-06-17 08:14:48 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 11:42:43 -0400
commit4ec86d4c86fe563482f183243f15bcd5fd3e65c5 (patch)
treec8607b098a1143c432c003b3befeb37bb4a92947 /net/bluetooth/mgmt.c
parent8ba8b4c05c3562d771fbfd2e7ee5648b41f04a9d (diff)
Bluetooth: Fix validating IO capability values in mgmt commands
The valid range of IO capabilities for the Set IO Capability and Pair Device mgmt commands is 0-4 (4 being the KeyboarDisplay capability for SMP). We should return an invalid parameters error if user space gives us a value outside of this range. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 99eb845865ef..5bf032d9bce1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2766,6 +2766,10 @@ static int set_io_capability(struct sock *sk, struct hci_dev *hdev, void *data,
2766 2766
2767 BT_DBG(""); 2767 BT_DBG("");
2768 2768
2769 if (cp->io_capability > SMP_IO_KEYBOARD_DISPLAY)
2770 return cmd_complete(sk, hdev->id, MGMT_OP_SET_IO_CAPABILITY,
2771 MGMT_STATUS_INVALID_PARAMS, NULL, 0);
2772
2769 hci_dev_lock(hdev); 2773 hci_dev_lock(hdev);
2770 2774
2771 hdev->io_capability = cp->io_capability; 2775 hdev->io_capability = cp->io_capability;
@@ -2878,6 +2882,11 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
2878 MGMT_STATUS_INVALID_PARAMS, 2882 MGMT_STATUS_INVALID_PARAMS,
2879 &rp, sizeof(rp)); 2883 &rp, sizeof(rp));
2880 2884
2885 if (cp->io_cap > SMP_IO_KEYBOARD_DISPLAY)
2886 return cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE,
2887 MGMT_STATUS_INVALID_PARAMS,
2888 &rp, sizeof(rp));
2889
2881 hci_dev_lock(hdev); 2890 hci_dev_lock(hdev);
2882 2891
2883 if (!hdev_is_powered(hdev)) { 2892 if (!hdev_is_powered(hdev)) {