Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290978
b: refs/heads/master
c: f0eeea8
h: refs/heads/master
v: v3
  • Loading branch information
Johan Hedberg committed Feb 19, 2012
1 parent f6f7be8 commit bc2f3d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 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: f808e166e7c529a7e706cda916c8c99589d2d95b
refs/heads/master: f0eeea8b61d6e8316f6137b372eb3f3ac180508c
31 changes: 18 additions & 13 deletions trunk/net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,7 @@ static int block_device(struct sock *sk, u16 index, void *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_block_device *cp = data;
u8 status;
int err;

BT_DBG("hci%u", index);
Expand All @@ -2394,18 +2395,20 @@ static int block_device(struct sock *sk, u16 index, void *data, u16 len)

hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS);
return cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS,
&cp->addr, sizeof(cp->addr));

hci_dev_lock(hdev);

err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type);
if (err < 0)
err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE,
MGMT_STATUS_FAILED);
status = MGMT_STATUS_FAILED;
else
err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, 0,
NULL, 0);
status = 0;

err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, status,
&cp->addr, sizeof(cp->addr));

hci_dev_unlock(hdev);
hci_dev_put(hdev);
Expand All @@ -2417,6 +2420,7 @@ static int unblock_device(struct sock *sk, u16 index, void *data, u16 len)
{
struct hci_dev *hdev;
struct mgmt_cp_unblock_device *cp = data;
u8 status;
int err;

BT_DBG("hci%u", index);
Expand All @@ -2427,19 +2431,20 @@ static int unblock_device(struct sock *sk, u16 index, void *data, u16 len)

hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS);
return cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS,
&cp->addr, sizeof(cp->addr));

hci_dev_lock(hdev);

err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type);

if (err < 0)
err = cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE,
MGMT_STATUS_INVALID_PARAMS);
status = MGMT_STATUS_INVALID_PARAMS;
else
err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, 0,
NULL, 0);
status = 0;

err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, status,
&cp->addr, sizeof(cp->addr));

hci_dev_unlock(hdev);
hci_dev_put(hdev);
Expand Down

0 comments on commit bc2f3d4

Please sign in to comment.