OSDN Git Service

DO NOT MERGE Fix unexpected behavior in smp_sm_event
authorHansong Zhang <hsz@google.com>
Fri, 30 Mar 2018 23:55:49 +0000 (16:55 -0700)
committerhamzeh <hamzeh@google.com>
Thu, 17 May 2018 15:02:35 +0000 (08:02 -0700)
Bug: 74121126
Test: manual
Change-Id: Ie5dd841d6461ad057c4ab572007f38c5446aba53
(cherry picked from commit 61c9430c58544b4bd4846ed0d5e6de0ae5150414)

stack/smp/smp_main.c

index c3709f8..2727af8 100644 (file)
@@ -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");