From abf3cc9746de30cbf738bbcc9de87eccc6117bc2 Mon Sep 17 00:00:00 2001
From: Dowon Park <dowon.park@samsung.com>
Date: Tue, 31 Aug 2021 17:17:32 +0900
Subject: [PATCH] Fix null pointer dereference in HACK_acl_check_sm4

fix to return when p_acl is null to avoid null pointer dereference
problem.

Sponsor: cmanton@
Bug: 198338740
Tag: #refactor
Test: gd/cert/run

Change-Id: I45408a2b024dc424442bf3c2f92293b8942b54bb
Signed-off-by: Dowon Park <dowon.park@samsung.com>
---
 system/stack/acl/btm_acl.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index 3d66cb90302..90f70ad7924 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -2960,6 +2960,7 @@ void HACK_acl_check_sm4(tBTM_SEC_DEV_REC& record) {
   if (p_acl == nullptr) {
     LOG_WARN("Unable to find active acl for authentication device:%s",
              PRIVATE_ADDRESS(record.RemoteAddress()));
+    return;
   }
 
   // If we have not received the SSP feature record
-- 
GitLab