]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Bluetooth: mgmt: Fix (Un)Block Device return parameters
authorJohan Hedberg <johan.hedberg@intel.com>
Sun, 19 Feb 2012 10:58:54 +0000 (12:58 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 19 Feb 2012 12:04:41 +0000 (14:04 +0200)
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>
net/bluetooth/mgmt.c

index 258adf44493619af4771ad9b8cb3e757a8503b45..c7e9a450b4431d23a04057b86311fcbaa1f36934 100644 (file)
@@ -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);
@@ -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);
@@ -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);
@@ -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);