Android 12.1.0 release 20
HAL: Fixed vendor HAL crash due to missing unregisterVendorHandler() in some failure case

WifiNative Failure(HAL crash) happened in vendor hal library due to FORTIFY abort.
According to the FORTIFY message, it caused by pthread_mutex_destroy called on a destroyed mutex.

The situation is as follows:
-----------------------
1. RTT cmd failed, so that cmd unregistered, cmd object destroyed. But, vendor handler is still exist in the related list.
2. RTT event received. It handled in internal_valid_message_handler() since the record of RTT vendor handler is still exist.
3. Finally, FORTIFY abort detected when pthread_mutext_destroy() on destroyed memory during releaseRef()
   |- internal_valid_message_handler()
      |- cmd->releaseRef()
         |- destructor chains called
            |- ...
            |- ~Condition() /* crashed here when try to destroy mMutex member */
-----------------------

Hence, this won't be happened if unregisterVendorhandler() called properly in some failure cases.
In case of RTT cmd failure, unregisterVendorhandler() should be called before wifi_unregister_cmd() & object destroyed.
In addition, all places with this pattern have been fixed together.

Bug: 210167945
Test: Local build done for Hikey960/Android 12(S), basic Wi-Fi functions worked well.
Test: passed sanity test
Change-Id: Icf4354c4eee74cac3ebedcaba1116320e750b2a3
Merged-In: Icf4354c4eee74cac3ebedcaba1116320e750b2a3
(cherry picked from commit 9d4683f3e3304848b3bfd883ade0649bb024573b)
3 files changed
tree: 77def538324d5a7cfe5297de72a5a0715e78ba93
  1. bcmdhd/
  2. .gitignore
  3. CleanSpec.mk
  4. METADATA