• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


コミットメタ情報

リビジョン98ed90c94a3f6c18049f19e3a28d2959e8e5423b (tree)
日時2019-02-13 06:10:31
作者Hansong Zhang <hsz@goog...>
コミッターJP Sugarbroad

ログメッセージ

DO NOT MERGE btm_proc_smp_cback: Don't access p_dev_rec if freed

In btm_proc_smp_cback(), return after p_dev_rec is freed in the middle
to prevent use after free

Bug: 120612744
Test: Use ASAN build; connect to a LE device and wait for timeout
Change-Id: I09aa1cf1d1c835146b62d0f4989aeedfb885d95b
(cherry picked from commit 74c6d501ce55e7bbce4129fae26bd0b5f802a7fc)

変更サマリ

差分

--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -39,6 +39,7 @@
3939 #include "device/include/controller.h"
4040 #include "gap_api.h"
4141 #include "hcimsgs.h"
42+#include "log/log.h"
4243 #include "l2c_int.h"
4344 #include "osi/include/log.h"
4445 #include "smp_api.h"
@@ -2090,6 +2091,13 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
20902091
20912092 if (event == SMP_COMPLT_EVT)
20922093 {
2094+ p_dev_rec = btm_find_dev(bd_addr);
2095+ if (p_dev_rec == NULL)
2096+ {
2097+ BTM_TRACE_ERROR ("%s: p_dev_rec is NULL", __func__);
2098+ android_errorWriteLog(0x534e4554, "120612744");
2099+ return 0;
2100+ }
20932101 BTM_TRACE_DEBUG ("evt=SMP_COMPLT_EVT before update sec_level=0x%x sec_flags=0x%x", p_data->cmplt.sec_level , p_dev_rec->sec_flags );
20942102
20952103 res = (p_data->cmplt.reason == SMP_SUCCESS) ? BTM_SUCCESS : BTM_ERR_PROCESSING;