summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHansong Zhang <hsz@google.com>2018-03-30 16:27:37 -0700
committerTim Schumacher <timschumi@gmx.de>2018-07-16 21:04:40 +0200
commit564dece781bbcc17efb5c72834d92414477e14bb (patch)
treedf3705dc08fc55ee5bc389afd8ee8e7a4e9450c6
parentdaac0f25efc5266c2d36d7557a409daa78d4bc1b (diff)
downloadandroid_system_bt-564dece781bbcc17efb5c72834d92414477e14bb.tar.gz
android_system_bt-564dece781bbcc17efb5c72834d92414477e14bb.tar.bz2
android_system_bt-564dece781bbcc17efb5c72834d92414477e14bb.zip
DO NOT MERGE Fix unexpected behavior in smp_sm_event
Bug: 74121126 Test: manual Change-Id: Ie5dd841d6461ad057c4ab572007f38c5446aba53 (cherry picked from commit 652798b2f2d6c90e0fc95c00ccfb91e2870b03d4)
-rw-r--r--stack/smp/smp_main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stack/smp/smp_main.c b/stack/smp/smp_main.c
index e05f934e1..c02b62e85 100644
--- a/stack/smp/smp_main.c
+++ b/stack/smp/smp_main.c
@@ -20,6 +20,7 @@
#if SMP_INCLUDED == TRUE
+#include <cutils/log.h>
#include <string.h>
#include "smp_int.h"
@@ -770,6 +771,13 @@ void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
UINT8 curr_state = p_cb->state;
tSMP_SM_TBL state_table;
UINT8 action, entry, i;
+
+ if (p_cb->role >= 2) {
+ SMP_TRACE_DEBUG("Invalid role: %d", p_cb->role);
+ android_errorWriteLog(0x534e4554, "74121126");
+ return;
+ }
+
tSMP_ENTRY_TBL entry_table = smp_entry_table[p_cb->role];
SMP_TRACE_EVENT("main smp_sm_event");