aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 69afbb2df133..f75a090cd7e4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4349,12 +4349,12 @@ static int set_debug_keys(struct sock *sk, struct hci_dev *hdev,
4349 void *data, u16 len) 4349 void *data, u16 len)
4350{ 4350{
4351 struct mgmt_mode *cp = data; 4351 struct mgmt_mode *cp = data;
4352 bool changed; 4352 bool changed, use_changed;
4353 int err; 4353 int err;
4354 4354
4355 BT_DBG("request for %s", hdev->name); 4355 BT_DBG("request for %s", hdev->name);
4356 4356
4357 if (cp->val != 0x00 && cp->val != 0x01) 4357 if (cp->val != 0x00 && cp->val != 0x01 && cp->val != 0x02)
4358 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEBUG_KEYS, 4358 return cmd_status(sk, hdev->id, MGMT_OP_SET_DEBUG_KEYS,
4359 MGMT_STATUS_INVALID_PARAMS); 4359 MGMT_STATUS_INVALID_PARAMS);
4360 4360
@@ -4367,6 +4367,20 @@ static int set_debug_keys(struct sock *sk, struct hci_dev *hdev,
4367 changed = test_and_clear_bit(HCI_KEEP_DEBUG_KEYS, 4367 changed = test_and_clear_bit(HCI_KEEP_DEBUG_KEYS,
4368 &hdev->dev_flags); 4368 &hdev->dev_flags);
4369 4369
4370 if (cp->val == 0x02)
4371 use_changed = !test_and_set_bit(HCI_USE_DEBUG_KEYS,
4372 &hdev->dev_flags);
4373 else
4374 use_changed = test_and_clear_bit(HCI_USE_DEBUG_KEYS,
4375 &hdev->dev_flags);
4376
4377 if (hdev_is_powered(hdev) && use_changed &&
4378 test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
4379 u8 mode = (cp->val == 0x02) ? 0x01 : 0x00;
4380 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_DEBUG_MODE,
4381 sizeof(mode), &mode);
4382 }
4383
4370 err = send_settings_rsp(sk, MGMT_OP_SET_DEBUG_KEYS, hdev); 4384 err = send_settings_rsp(sk, MGMT_OP_SET_DEBUG_KEYS, hdev);
4371 if (err < 0) 4385 if (err < 0)
4372 goto unlock; 4386 goto unlock;