summaryrefslogtreecommitdiffstats
path: root/bcmdhd/wifi_hal
diff options
context:
space:
mode:
authorVinit Deshpande <vinitd@google.com>2015-06-04 20:01:03 -0700
committerVinit Deshpande <vinitd@google.com>2015-06-04 20:01:03 -0700
commit974df1c535fa4aa5c191d47877aa27c79fad0263 (patch)
treeec531a5bcf201623d08db6044d8f66801b8c8977 /bcmdhd/wifi_hal
parent79c41bc9ff10a322cf6cacc51b80707d5ba5a4ee (diff)
downloadhardware_broadcom_wlan-974df1c535fa4aa5c191d47877aa27c79fad0263.zip
hardware_broadcom_wlan-974df1c535fa4aa5c191d47877aa27c79fad0263.tar.gz
hardware_broadcom_wlan-974df1c535fa4aa5c191d47877aa27c79fad0263.tar.bz2
Fix a deadlock in wifi_cleanup
pthread_mutex isn't re-entrant; and results in a hang if called second time from the same thread. This change ensures that it is locked only once. Bug: 21627368 Change-Id: I9c28c1df240316c2a7eafdefa990b9582bc05a9a
Diffstat (limited to 'bcmdhd/wifi_hal')
-rw-r--r--bcmdhd/wifi_hal/wifi_hal.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp
index 03bcc4b..20d2b28 100644
--- a/bcmdhd/wifi_hal/wifi_hal.cpp
+++ b/bcmdhd/wifi_hal/wifi_hal.cpp
@@ -283,7 +283,9 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler)
WifiCommand *cmd = (WifiCommand *)cbi->cb_arg;
if (cmd != NULL) {
cmd->addRef();
+ pthread_mutex_unlock(&info->cb_lock);
cmd->cancel();
+ pthread_mutex_lock(&info->cb_lock);
cmd->releaseRef();
}
}