summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYun Park <yunp@qca.qualcomm.com>2015-07-23 17:28:05 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-07-28 03:19:48 -0700
commitfa4c38955d245c659d9129fdf7eb7cedf2cc3f70 (patch)
tree23b6321a80ba47ddfba461e65a44e318efd21fe7
parent69e3310fc692dc327efac11bc01cb4e4e8ab1bae (diff)
qcacld: Fix potential out of bounds issues in unsafe channel count
Change to avoid potential out of bound issues when unsafe channel count parameter is invalid in Channel Avoid callback. Change-Id: I03c67db776c7ccfe9a13e5b66adf5fa8078987ff CRs-Fixed: 880305
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 8dc58f33ebb4..9ef368a272c2 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -13474,11 +13474,24 @@ void hdd_ch_avoid_cb
}
#ifdef CONFIG_CNSS
- cnss_set_wlan_unsafe_channel(hdd_ctxt->unsafe_channel_list,
- hdd_ctxt->unsafe_channel_count);
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
- "%s : number of unsafe channels is %d ",
- __func__, hdd_ctxt->unsafe_channel_count);
+ "%s : number of unsafe channels is %d ",
+ __func__, hdd_ctxt->unsafe_channel_count);
+
+ if (cnss_set_wlan_unsafe_channel(hdd_ctxt->unsafe_channel_list,
+ hdd_ctxt->unsafe_channel_count)) {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: Failed to set unsafe channel",
+ __func__);
+
+ /* clear existing unsafe channel cache */
+ hdd_ctxt->unsafe_channel_count = 0;
+ vos_mem_zero(hdd_ctxt->unsafe_channel_list,
+ sizeof(v_U16_t) * NUM_20MHZ_RF_CHANNELS);
+
+ return;
+ }
+
for (channel_loop = 0;
channel_loop < hdd_ctxt->unsafe_channel_count;
channel_loop++)