diff options
author | Ethan Chen <intervigil@gmail.com> | 2016-04-22 12:42:57 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-08-31 22:53:27 -0700 |
commit | 0f38186edc51c5ed9ce88494bc92bf93a4b61ac4 (patch) | |
tree | 5e69139618594a6e8a3b30c76883f56877271f8c | |
parent | d3f227c6c5c1478c8508e5ed1d899f218b816674 (diff) | |
download | android_frameworks_opt_net_wifi-0f38186edc51c5ed9ce88494bc92bf93a4b61ac4.tar.gz android_frameworks_opt_net_wifi-0f38186edc51c5ed9ce88494bc92bf93a4b61ac4.tar.bz2 android_frameworks_opt_net_wifi-0f38186edc51c5ed9ce88494bc92bf93a4b61ac4.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) { |