summaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-19 13:16:14 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-19 14:04:41 +0200
commitbf1e3541f75a395e1e21b144fe1c387cc71baff1 (patch)
treef3642fa6f2acb8273a620fc185265b9395d0975f /net/bluetooth/mgmt.c
parentf0eeea8b61d6e8316f6137b372eb3f3ac180508c (diff)
Bluetooth: mgmt: Fix OOB command response parameters
The response to the Add/Remove Out Of Band Data commands should include the same address as was given in the command itself. 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.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index c7e9a450b443..952c0a8ca305 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2094,6 +2094,7 @@ static int add_remote_oob_data(struct sock *sk, u16 index, void *data,
{
struct hci_dev *hdev;
struct mgmt_cp_add_remote_oob_data *cp = data;
+ u8 status;
int err;
BT_DBG("hci%u ", index);
@@ -2104,19 +2105,21 @@ static int add_remote_oob_data(struct sock *sk, u16 index, void *data,
hdev = hci_dev_get(index);
if (!hdev)
- return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA,
- MGMT_STATUS_INVALID_PARAMS);
+ return cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA,
+ MGMT_STATUS_INVALID_PARAMS,
+ &cp->addr, sizeof(cp->addr));
hci_dev_lock(hdev);
err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, cp->hash,
cp->randomizer);
if (err < 0)
- err = cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA,
- MGMT_STATUS_FAILED);
+ status = MGMT_STATUS_FAILED;
else
- err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, 0,
- NULL, 0);
+ status = 0;
+
+ err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, status,
+ &cp->addr, sizeof(cp->addr));
hci_dev_unlock(hdev);
hci_dev_put(hdev);
@@ -2129,6 +2132,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
{
struct hci_dev *hdev;
struct mgmt_cp_remove_remote_oob_data *cp = data;
+ u8 status;
int err;
BT_DBG("hci%u ", index);
@@ -2139,18 +2143,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
hdev = hci_dev_get(index);
if (!hdev)
- return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
- MGMT_STATUS_INVALID_PARAMS);
+ return cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
+ MGMT_STATUS_INVALID_PARAMS,
+ &cp->addr, sizeof(cp->addr));
hci_dev_lock(hdev);
err = hci_remove_remote_oob_data(hdev, &cp->addr.bdaddr);
if (err < 0)
- err = cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
- MGMT_STATUS_INVALID_PARAMS);
+ status = MGMT_STATUS_INVALID_PARAMS;
else
- err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
- 0, NULL, 0);
+ status = 0;
+
+ err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, status,
+ &cp->addr, sizeof(cp->addr));
hci_dev_unlock(hdev);
hci_dev_put(hdev);