OSDN Git Service

Fix NPE in l2cble_notify_le_connection
authorJakub Pawlowski <jpawlowski@google.com>
Thu, 15 Sep 2016 15:04:04 +0000 (08:04 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Thu, 15 Sep 2016 21:42:19 +0000 (21:42 +0000)
Accessing p_lcb must be guarded with NULL check.

Bug: 31442085
Change-Id: I0f6e3f8e0247c5e8946c4d098f8a3ba442f5fb28

stack/l2cap/l2c_ble.c

index cc8864e..af104d1 100644 (file)
@@ -294,11 +294,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);