Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352255
b: refs/heads/master
c: 4ee71b2
h: refs/heads/master
i:
  352253: a0ca479
  352251: 6922928
  352247: f582945
  352239: 3a68e96
  352223: 4a360b6
  352191: 812fe48
  352127: 303694c
  351999: ce666a4
  351743: b06b4f0
  351231: e0521f9
  350207: 6c71417
  348159: 2fe83f9
  344063: 542864c
v: v3
  • Loading branch information
Johan Hedberg authored and Gustavo Padovan committed Jan 23, 2013
1 parent a0b9a40 commit 8f9982f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 679efe2b4fcbe575bc4c94c410039e35c169bfb6
refs/heads/master: 4ee71b2017336f68128515bdbe7c946a39aa9250
36 changes: 34 additions & 2 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,14 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
BT_DBG("%s debug_keys %u key_count %u", hdev->name, cp->debug_keys,
key_count);

for (i = 0; i < key_count; i++) {
struct mgmt_link_key_info *key = &cp->keys[i];

if (key->addr.type != BDADDR_BREDR)
return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
MGMT_STATUS_INVALID_PARAMS);
}

hci_dev_lock(hdev);

hci_link_keys_clear(hdev);
Expand Down Expand Up @@ -1573,12 +1581,17 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
struct hci_conn *conn;
int err;

hci_dev_lock(hdev);

memset(&rp, 0, sizeof(rp));
bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr);
rp.addr.type = cp->addr.type;

if (!bdaddr_type_is_valid(cp->addr.type))
return cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
MGMT_STATUS_INVALID_PARAMS,
&rp, sizeof(rp));

hci_dev_lock(hdev);

if (!hdev_is_powered(hdev)) {
err = cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
MGMT_STATUS_NOT_POWERED, &rp, sizeof(rp));
Expand Down Expand Up @@ -1643,6 +1656,10 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,

BT_DBG("");

if (!bdaddr_type_is_valid(cp->addr.type))
return cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
MGMT_STATUS_INVALID_PARAMS);

hci_dev_lock(hdev);

if (!test_bit(HCI_UP, &hdev->flags)) {
Expand Down Expand Up @@ -1947,6 +1964,11 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr);
rp.addr.type = cp->addr.type;

if (!bdaddr_type_is_valid(cp->addr.type))
return cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE,
MGMT_STATUS_INVALID_PARAMS,
&rp, sizeof(rp));

hci_dev_lock(hdev);

if (!hdev_is_powered(hdev)) {
Expand Down Expand Up @@ -2564,6 +2586,10 @@ static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,

BT_DBG("%s", hdev->name);

if (!bdaddr_type_is_valid(cp->addr.type))
return cmd_status(sk, hdev->id, MGMT_OP_BLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS);

hci_dev_lock(hdev);

err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type);
Expand All @@ -2589,6 +2615,10 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,

BT_DBG("%s", hdev->name);

if (!bdaddr_type_is_valid(cp->addr.type))
return cmd_status(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS);

hci_dev_lock(hdev);

err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type);
Expand Down Expand Up @@ -2707,6 +2737,8 @@ static bool ltk_is_valid(struct mgmt_ltk_info *key)
return false;
if (key->master != 0x00 && key->master != 0x01)
return false;
if (!bdaddr_type_is_le(key->addr.type))
return false;
return true;
}

Expand Down

0 comments on commit 8f9982f

Please sign in to comment.