wifi Clear the callbacks before executing terminate
The HIDL IPCThreadState will be crashed if
IPCThreadState:shutdown called during transact.
The terminate will execute the shutdown and after the HIDL clear.
The hostapd clean will remove the iface cause the client connection
callback happen. But the callback should not execute after the shutdown
HIDL.
Bug: 173605884
Test: Test code. Force call the eloop_terminate() after receive client
connected. The crash will happen in hostapd_deinit interface when
hostapd try to execute hidl callback to notify client disconnection.
Change-Id: Ic23b0d21921ef4dcf769491ffa63ae12ff316fe3
diff --git a/hostapd/hidl/1.3/hostapd.cpp b/hostapd/hidl/1.3/hostapd.cpp
index ad0c0f2..274a079 100644
--- a/hostapd/hidl/1.3/hostapd.cpp
+++ b/hostapd/hidl/1.3/hostapd.cpp
@@ -658,6 +658,9 @@
Return<void> Hostapd::terminate()
{
wpa_printf(MSG_INFO, "Terminating...");
+ // Clear the callback to avoid IPCThreadState shutdown during the
+ // callback event.
+ callbacks_.clear();
eloop_terminate();
return Void();
}