diff options
author | Jakub Pawlowski <jpawlowski@google.com> | 2016-09-15 08:04:04 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2016-09-16 17:33:26 +0000 |
commit | 5e61112a98712c872560a1c7aa2f6ab7102c4da4 (patch) | |
tree | 7fcff303e69a9606d0634a34094aa5595c77f44d | |
parent | b4a5ec958fbea79dc4603b1f0a2497009bc59983 (diff) | |
download | bt-5e61112a98712c872560a1c7aa2f6ab7102c4da4.tar.gz |
Fix NPE in l2cble_notify_le_connection
Accessing p_lcb must be guarded with NULL check.
Bug: 31442085
Change-Id: I0f6e3f8e0247c5e8946c4d098f8a3ba442f5fb28
(cherry picked from commit b4458c93d5b5d7e2c103166d71daff560ee1a978)
-rw-r--r-- | stack/l2cap/l2c_ble.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/stack/l2cap/l2c_ble.c b/stack/l2cap/l2c_ble.c index 5a3a569c1..0f7eda6ad 100644 --- a/stack/l2cap/l2c_ble.c +++ b/stack/l2cap/l2c_ble.c @@ -293,11 +293,13 @@ void l2cble_notify_le_connection (BD_ADDR bda) l2cu_process_fixed_chnl_resp (p_lcb); } - /* For all channels, send the event through their FSMs */ - for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) - { - if (p_ccb->chnl_state == CST_CLOSED) - l2c_csm_execute (p_ccb, L2CEVT_LP_CONNECT_CFM, NULL); + if (p_lcb != NULL) { + /* For all channels, send the event through their FSMs */ + for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb; p_ccb = p_ccb->p_next_ccb) + { + if (p_ccb->chnl_state == CST_CLOSED) + l2c_csm_execute (p_ccb, L2CEVT_LP_CONNECT_CFM, NULL); + } } l2cble_use_preferred_conn_params(bda); |