wlan: Update channel list only once during wlan load

Currently, during WLAN driver load, when wiphy is registered from
hdd_wlan_startup(), __wlan_hdd_linux_reg_notifier() is invoked from same
context with regulatory info as argument. If country_code in regulatory
info is valid and user-set, then eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE
is posted to SME and startup thread continues to execute. But MC and
startup threads can run concurrently and execute
sme_HandleChangeCountryCodeByUsertry() and wlan_hdd_init_channels_for_cc()
respectively to update channel list (channelPowerInfoList24) of scan
context in pmac. Simultaneous update of channelPowerInfoList24 is
seen only during wlan load for user country.

Though list is lock protected still race condition is seen due to
acquire and release of list lock for each insert (critical section)
exclusively whereas delete of entire list is in one critical section.
This is leading to use after free scenario, where MC thread is trying
to access list element with stale pointer which was deleted from
startup thread.

To fix this, use init_by_reg_core flag to update channel list only from
MC thread during wlan load for user country code.

Change-Id: I5e8c7565481d805230000357308fc84927616657
CRs-Fixed: 2360881
3 files changed
tree: 8c7391407a1da4241a9dafa221e614d2386bb544
  1. CORE/
  2. firmware_bin/
  3. riva/
  4. Android.mk
  5. Kbuild
  6. Kconfig
  7. Makefile