wlan: Set tdls mode to disable in case of unloading.
At the time of driver unload; if tdls connection is present
and if traffic is going on; hdd_rx_packet_cbk calls
wlan_hdd_tdls_find_peer.
wlan_hdd_tdls_find_peer always checks for valid context before
finding peer in list.
As a sanity check driver will print error message as
load/unload in progress and that can be result in excessive logging.
hdd_rx_packet_cbk calls wlan_hdd_tdls_find_peer only
when tdls state is enabled.
Fix this issue by making TDLS as disable.
CRs-Fixed: 767748
Change-Id: I48fb26028011e1a4dc0a8dd0fa332c2c6d850e91
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 64671cd..2dc5758 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -8116,6 +8116,20 @@
// Unloading, restart logic is no more required.
wlan_hdd_restart_deinit(pHddCtx);
+#ifdef FEATURE_WLAN_TDLS
+ /* At the time of driver unloading; if tdls connection is present;
+ * hdd_rx_packet_cbk calls wlan_hdd_tdls_find_peer.
+ * wlan_hdd_tdls_find_peer always checks for valid context;
+ * as load/unload in progress there can be a race condition.
+ * hdd_rx_packet_cbk calls wlan_hdd_tdls_find_peer only
+ * when tdls state is enabled.
+ * As soon as driver set load/unload flag; tdls flag also needs
+ * to be disabled so that hdd_rx_packet_cbk won't call
+ * wlan_hdd_tdls_find_peer.
+ */
+ wlan_hdd_tdls_set_mode(pHddCtx, eTDLS_SUPPORT_DISABLED, FALSE);
+#endif
+
vosStatus = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
while (NULL != pAdapterNode && VOS_STATUS_E_EMPTY != vosStatus)
{