Skip to content

Commit

Permalink
Bluetooth: Avoid Spurious AMP node access if not created
Browse files Browse the repository at this point in the history
Added checks for avoiding the AMP nodes, incase of Spurious
access like data corruption during Rx from BT SOC

Signed-off-by: Balvinder Singh <[email protected]>
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
Balvinder Singh authored and totalatot committed Sep 17, 2017
1 parent b0f1f84 commit ef0b907
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,7 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
{
struct hci_ev_phy_link_complete *ev = (void *) skb->data;
struct hci_conn *hcon, *bredr_hcon;
struct amp_mgr *mgr;

BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle,
ev->status);
Expand All @@ -3435,6 +3436,14 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
return;
}

BT_DBG("hcon %p mgr %p", hcon, hcon->amp_mgr);

mgr = hcon->amp_mgr;
if (!(mgr && mgr->l2cap_conn && mgr->l2cap_conn->hcon)) {
hci_dev_unlock(hdev);
BT_DBG("Amp Manager is not Initialized");
return;
}
bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon;

hcon->state = BT_CONNECTED;
Expand Down

0 comments on commit ef0b907

Please sign in to comment.