From da3607d6f5715022c53f52b7ed700be0fdc66e46 Mon Sep 17 00:00:00 2001 From: Vinit Deshpande Date: Thu, 4 Jun 2015 20:01:03 -0700 Subject: 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 --- bcmdhd/wifi_hal/wifi_hal.cpp | 2 ++ 1 file changed, 2 insertions(+) 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(); } } -- cgit v1.1