aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-05-29 06:59:12 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:13 -0400
commita28381dc9ca3e54b0678e2cd7c68c1afb2d7cc76 (patch)
treede2a390f7515578fea1421039c9efe256ed48f41 /net/bluetooth
parent47f2d97d38816aaca94c9b6961c6eff1cfcd0bd6 (diff)
Bluetooth: A2MP: Process A2MP Get AMP Assoc Request
Example trace when receiving AMP Assoc Request with wrong AMP id. ... > ACL data: handle 11 flags 0x02 dlen 13 A2MP: Get AMP Assoc req: id 238 < ACL data: handle 11 flags 0x00 dlen 14 A2MP: Get AMP Assoc rsp: id 238 status (1) Invalid Controller ID assoc data: ... Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/a2mp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 350088e2015a..b8eeb33d60d7 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -211,6 +211,38 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb,
211 return 0; 211 return 0;
212} 212}
213 213
214static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb,
215 struct a2mp_cmd *hdr)
216{
217 struct a2mp_amp_assoc_req *req = (void *) skb->data;
218 struct hci_dev *hdev;
219
220 if (le16_to_cpu(hdr->len) < sizeof(*req))
221 return -EINVAL;
222
223 BT_DBG("id %d", req->id);
224
225 hdev = hci_dev_get(req->id);
226 if (!hdev || hdev->amp_type == HCI_BREDR) {
227 struct a2mp_amp_assoc_rsp rsp;
228 rsp.id = req->id;
229 rsp.status = A2MP_STATUS_INVALID_CTRL_ID;
230
231 a2mp_send(mgr, A2MP_GETAMPASSOC_RSP, hdr->ident, sizeof(rsp),
232 &rsp);
233 goto clean;
234 }
235
236 /* Placeholder for HCI Read AMP Assoc */
237
238clean:
239 if (hdev)
240 hci_dev_put(hdev);
241
242 skb_pull(skb, sizeof(*req));
243 return 0;
244}
245
214/* Handle A2MP signalling */ 246/* Handle A2MP signalling */
215static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) 247static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
216{ 248{
@@ -253,6 +285,9 @@ static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
253 break; 285 break;
254 286
255 case A2MP_GETAMPASSOC_REQ: 287 case A2MP_GETAMPASSOC_REQ:
288 err = a2mp_getampassoc_req(mgr, skb, hdr);
289 break;
290
256 case A2MP_CREATEPHYSLINK_REQ: 291 case A2MP_CREATEPHYSLINK_REQ:
257 case A2MP_DISCONNPHYSLINK_REQ: 292 case A2MP_DISCONNPHYSLINK_REQ:
258 case A2MP_CHANGE_RSP: 293 case A2MP_CHANGE_RSP: