prima: Dereferencing uninitialized pointer while disabling channels
Accessing n_channels variable from wiphy bands that is
uninitialized which causes NULL pointer dereference in both
wlan_hdd_disable_channels() and wlan_hdd_restore_channels()
functions.
To address this, add NULL check for wiphy bands in both functions.
Change-Id: I937c3d70a6b93768fbe9e2d931dbde60aedc449d
CRs-Fixed: 2320898
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index b609667..c17fab2 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -10857,6 +10857,8 @@
for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS;
band_num++) {
+ if (!wiphy->bands[band_num])
+ continue;
for (channel_num = 0; channel_num <
wiphy->bands[band_num]->n_channels;
channel_num++) {
@@ -10936,6 +10938,8 @@
for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS;
band_num++) {
+ if (!wiphy->bands[band_num])
+ continue;
for (band_ch_num = 0; band_ch_num <
wiphy->bands[band_num]->n_channels;
band_ch_num++) {