aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-19 05:58:54 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-19 07:04:41 -0500
commitf0eeea8b61d6e8316f6137b372eb3f3ac180508c (patch)
tree15cee3f22163779cb7935f3ecd16f30ee043a6f7 /net/bluetooth/mgmt.c
parentf808e166e7c529a7e706cda916c8c99589d2d95b (diff)
Bluetooth: mgmt: Fix (Un)Block Device return parameters
The same address as was passed to the (Un)Block Device command should also be returned in the command response message. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 258adf444936..c7e9a450b443 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2384,6 +2384,7 @@ static int block_device(struct sock *sk, u16 index, void *data, u16 len)
2384{ 2384{
2385 struct hci_dev *hdev; 2385 struct hci_dev *hdev;
2386 struct mgmt_cp_block_device *cp = data; 2386 struct mgmt_cp_block_device *cp = data;
2387 u8 status;
2387 int err; 2388 int err;
2388 2389
2389 BT_DBG("hci%u", index); 2390 BT_DBG("hci%u", index);
@@ -2394,18 +2395,20 @@ static int block_device(struct sock *sk, u16 index, void *data, u16 len)
2394 2395
2395 hdev = hci_dev_get(index); 2396 hdev = hci_dev_get(index);
2396 if (!hdev) 2397 if (!hdev)
2397 return cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, 2398 return cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE,
2398 MGMT_STATUS_INVALID_PARAMS); 2399 MGMT_STATUS_INVALID_PARAMS,
2400 &cp->addr, sizeof(cp->addr));
2399 2401
2400 hci_dev_lock(hdev); 2402 hci_dev_lock(hdev);
2401 2403
2402 err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type); 2404 err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type);
2403 if (err < 0) 2405 if (err < 0)
2404 err = cmd_status(sk, index, MGMT_OP_BLOCK_DEVICE, 2406 status = MGMT_STATUS_FAILED;
2405 MGMT_STATUS_FAILED);
2406 else 2407 else
2407 err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, 0, 2408 status = 0;
2408 NULL, 0); 2409
2410 err = cmd_complete(sk, index, MGMT_OP_BLOCK_DEVICE, status,
2411 &cp->addr, sizeof(cp->addr));
2409 2412
2410 hci_dev_unlock(hdev); 2413 hci_dev_unlock(hdev);
2411 hci_dev_put(hdev); 2414 hci_dev_put(hdev);
@@ -2417,6 +2420,7 @@ static int unblock_device(struct sock *sk, u16 index, void *data, u16 len)
2417{ 2420{
2418 struct hci_dev *hdev; 2421 struct hci_dev *hdev;
2419 struct mgmt_cp_unblock_device *cp = data; 2422 struct mgmt_cp_unblock_device *cp = data;
2423 u8 status;
2420 int err; 2424 int err;
2421 2425
2422 BT_DBG("hci%u", index); 2426 BT_DBG("hci%u", index);
@@ -2427,19 +2431,20 @@ static int unblock_device(struct sock *sk, u16 index, void *data, u16 len)
2427 2431
2428 hdev = hci_dev_get(index); 2432 hdev = hci_dev_get(index);
2429 if (!hdev) 2433 if (!hdev)
2430 return cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, 2434 return cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE,
2431 MGMT_STATUS_INVALID_PARAMS); 2435 MGMT_STATUS_INVALID_PARAMS,
2436 &cp->addr, sizeof(cp->addr));
2432 2437
2433 hci_dev_lock(hdev); 2438 hci_dev_lock(hdev);
2434 2439
2435 err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type); 2440 err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type);
2436
2437 if (err < 0) 2441 if (err < 0)
2438 err = cmd_status(sk, index, MGMT_OP_UNBLOCK_DEVICE, 2442 status = MGMT_STATUS_INVALID_PARAMS;
2439 MGMT_STATUS_INVALID_PARAMS);
2440 else 2443 else
2441 err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, 0, 2444 status = 0;
2442 NULL, 0); 2445
2446 err = cmd_complete(sk, index, MGMT_OP_UNBLOCK_DEVICE, status,
2447 &cp->addr, sizeof(cp->addr));
2443 2448
2444 hci_dev_unlock(hdev); 2449 hci_dev_unlock(hdev);
2445 hci_dev_put(hdev); 2450 hci_dev_put(hdev);