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

Commit bd7958cf authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

LE: Fix crash on LE mouse reconnect

Sometimes, a GKI exception may be observed when re-connecting to an LE
mouse. This patch properly handles the encryption state change, avoiding
a possible race condition leading to the exception.

Change-Id: I4cf139c1ac22e71b598272fccebf645cd73fdf6a
parent f186ce98
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2241,12 +2241,15 @@ static void btu_hcif_enhanced_flush_complete_evt (UINT8 *p, UINT16 evt_len)
static void btu_hcif_encyption_key_refresh_cmpl_evt (UINT8 *p, UINT16 evt_len)
{
    UINT8   status;
    UINT8   enc_enable = 0;
    UINT16  handle;

    STREAM_TO_UINT8  (status, p);
    STREAM_TO_UINT16 (handle, p);

    btm_sec_encrypt_change (handle, status, 1);
    if (status == HCI_SUCCESS) enc_enable = 1;

    btm_sec_encrypt_change (handle, status, enc_enable);
}

static void btu_ble_process_adv_pkt (UINT8 *p, UINT16 evt_len)