aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-19 06:16:14 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-19 07:04:41 -0500
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,
2094{ 2094{
2095 struct hci_dev *hdev; 2095 struct hci_dev *hdev;
2096 struct mgmt_cp_add_remote_oob_data *cp = data; 2096 struct mgmt_cp_add_remote_oob_data *cp = data;
2097 u8 status;
2097 int err; 2098 int err;
2098 2099
2099 BT_DBG("hci%u ", index); 2100 BT_DBG("hci%u ", index);
@@ -2104,19 +2105,21 @@ static int add_remote_oob_data(struct sock *sk, u16 index, void *data,
2104 2105
2105 hdev = hci_dev_get(index); 2106 hdev = hci_dev_get(index);
2106 if (!hdev) 2107 if (!hdev)
2107 return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, 2108 return cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA,
2108 MGMT_STATUS_INVALID_PARAMS); 2109 MGMT_STATUS_INVALID_PARAMS,
2110 &cp->addr, sizeof(cp->addr));
2109 2111
2110 hci_dev_lock(hdev); 2112 hci_dev_lock(hdev);
2111 2113
2112 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, cp->hash, 2114 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, cp->hash,
2113 cp->randomizer); 2115 cp->randomizer);
2114 if (err < 0) 2116 if (err < 0)
2115 err = cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, 2117 status = MGMT_STATUS_FAILED;
2116 MGMT_STATUS_FAILED);
2117 else 2118 else
2118 err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, 0, 2119 status = 0;
2119 NULL, 0); 2120
2121 err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, status,
2122 &cp->addr, sizeof(cp->addr));
2120 2123
2121 hci_dev_unlock(hdev); 2124 hci_dev_unlock(hdev);
2122 hci_dev_put(hdev); 2125 hci_dev_put(hdev);
@@ -2129,6 +2132,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
2129{ 2132{
2130 struct hci_dev *hdev; 2133 struct hci_dev *hdev;
2131 struct mgmt_cp_remove_remote_oob_data *cp = data; 2134 struct mgmt_cp_remove_remote_oob_data *cp = data;
2135 u8 status;
2132 int err; 2136 int err;
2133 2137
2134 BT_DBG("hci%u ", index); 2138 BT_DBG("hci%u ", index);
@@ -2139,18 +2143,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
2139 2143
2140 hdev = hci_dev_get(index); 2144 hdev = hci_dev_get(index);
2141 if (!hdev) 2145 if (!hdev)
2142 return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, 2146 return cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
2143 MGMT_STATUS_INVALID_PARAMS); 2147 MGMT_STATUS_INVALID_PARAMS,
2148 &cp->addr, sizeof(cp->addr));
2144 2149
2145 hci_dev_lock(hdev); 2150 hci_dev_lock(hdev);
2146 2151
2147 err = hci_remove_remote_oob_data(hdev, &cp->addr.bdaddr); 2152 err = hci_remove_remote_oob_data(hdev, &cp->addr.bdaddr);
2148 if (err < 0) 2153 if (err < 0)
2149 err = cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, 2154 status = MGMT_STATUS_INVALID_PARAMS;
2150 MGMT_STATUS_INVALID_PARAMS);
2151 else 2155 else
2152 err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, 2156 status = 0;
2153 0, NULL, 0); 2157
2158 err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA, status,
2159 &cp->addr, sizeof(cp->addr));
2154 2160
2155 hci_dev_unlock(hdev); 2161 hci_dev_unlock(hdev);
2156 hci_dev_put(hdev); 2162 hci_dev_put(hdev);