diff options
author | Ethan Chen <intervigil@gmail.com> | 2016-04-22 12:42:57 -0700 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2016-04-22 16:21:42 -0700 |
commit | eb9c90d1c8f48f2620804b79444674c8f35f1dda (patch) | |
tree | 644e6be40768c38860ddfbfc6d2425d39ce0d42d | |
parent | 4f30b2015a118d12033c070b686da71bc702a978 (diff) | |
download | android_frameworks_opt_net_wifi-eb9c90d1c8f48f2620804b79444674c8f35f1dda.tar.gz android_frameworks_opt_net_wifi-eb9c90d1c8f48f2620804b79444674c8f35f1dda.tar.bz2 android_frameworks_opt_net_wifi-eb9c90d1c8f48f2620804b79444674c8f35f1dda.zip |
Null check before accessing AP objects
* The AP item list is destroyed and re-created on driver load/unload.
* Check before accessing them, as the driver may be unloaded, which may
cause a null pointer dereference.
REF: CYNGNOS-2559
Change-Id: If4f7600f6156d650211a7ac85b48f95f16c761e7
-rw-r--r-- | service/jni/com_android_server_wifi_Gbk2Utf.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/service/jni/com_android_server_wifi_Gbk2Utf.cpp b/service/jni/com_android_server_wifi_Gbk2Utf.cpp index 194b44660..15bf31626 100644 --- a/service/jni/com_android_server_wifi_Gbk2Utf.cpp +++ b/service/jni/com_android_server_wifi_Gbk2Utf.cpp @@ -488,6 +488,10 @@ jboolean setNetworkVariable(char *buf) ALOGD("parse SET_NETWORK command success, netId = %d, name = %s, value =%s, length=%d", netId, name, value, strlen(value)); + if (NULL == g_pItemListMutex) { + /* Driver is unloaded, g_pItemList, g_pItemListMutex are NULL */ + return JNI_TRUE; + } pthread_mutex_lock(g_pItemListMutex); pTmpItemNode = g_pItemList; if (NULL == pTmpItemNode) { |