Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55c1a3b9 authored by Balvinder Singh's avatar Balvinder Singh Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth: Avoid Spurious AMP node access if not created



Added checks for avoiding the AMP nodes, incase of Spurious
access like data corruption during Rx from BT SOC

Change-Id: Ifc974750efe2082420f89f32580ed8ccd1924a3d
Signed-off-by: default avatarBalvinder Singh <bpsingh@codeaurora.org>
CRs-Fixed: 783934
parent a69c694d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4001,6 +4001,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);
@@ -4019,6 +4020,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;