summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2016-04-22 12:42:57 -0700
committerEthan Chen <intervigil@gmail.com>2016-04-22 16:21:42 -0700
commiteb9c90d1c8f48f2620804b79444674c8f35f1dda (patch)
tree644e6be40768c38860ddfbfc6d2425d39ce0d42d /service
parent4f30b2015a118d12033c070b686da71bc702a978 (diff)
downloadframeworks_opt_net_wifi-eb9c90d1c8f48f2620804b79444674c8f35f1dda.tar.gz
frameworks_opt_net_wifi-eb9c90d1c8f48f2620804b79444674c8f35f1dda.tar.bz2
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
Diffstat (limited to 'service')
-rw-r--r--service/jni/com_android_server_wifi_Gbk2Utf.cpp4
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 194b446..15bf316 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) {