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

Commit 08e57f7c authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Fix l2cu_initialize_fixed_ccb() to return only initialized entries

Update the l2cu_initialize_fixed_ccb() implementation so
it returns only entries that are properly initialized.
In some complex scenarios, the p_lcb->p_fixed_ccbs[] array
might contain an entry that has been released by l2cu_release_ccb(),
and such entry cannot be reused as-is.

Bug: 26927945
Change-Id: I42d42926cc6da6b8be662781545753c36b75968e
parent c6e28300
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2673,8 +2673,14 @@ BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR
    tL2C_CCB    *p_ccb;

    /* If we already have a CCB, then simply return */
    if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL] != NULL)
    p_ccb = p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL];
    if ((p_ccb != NULL) && p_ccb->in_use) {
        /*
         * NOTE: The "in_use" check is needed to ignore leftover entries
         * that have been already released by l2cu_release_ccb().
         */
        return (TRUE);
    }

    if ((p_ccb = l2cu_allocate_ccb (NULL, 0)) == NULL)
        return (FALSE);