diff options
author | Ethan Chen <intervigil@gmail.com> | 2016-04-22 12:42:57 -0700 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2017-01-01 23:10:28 +0200 |
commit | 8ae355afe1af12efda2b50d4ed3dbe3e1a18cb26 (patch) | |
tree | eedf0817314e63586f1a8472a3249fb8a0464cac | |
parent | 6a2311711dff248d942f5aeb102b73f110a46c90 (diff) | |
download | android_frameworks_opt_net_wifi-8ae355afe1af12efda2b50d4ed3dbe3e1a18cb26.tar.gz android_frameworks_opt_net_wifi-8ae355afe1af12efda2b50d4ed3dbe3e1a18cb26.tar.bz2 android_frameworks_opt_net_wifi-8ae355afe1af12efda2b50d4ed3dbe3e1a18cb26.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 7ff3da742..7e0f099f2 100644 --- a/service/jni/com_android_server_wifi_Gbk2Utf.cpp +++ b/service/jni/com_android_server_wifi_Gbk2Utf.cpp @@ -514,6 +514,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) { |