From ab6029b34a06015cc630cfb3fea2a7003063380c Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 24 May 2017 13:04:19 -0700 Subject: [PATCH] qcacld-3.0: Reject FTM command unless device is in FTM mode Currently, the device mode is not verified before servicing the FTM command. Reject FTM commands unless the device is in FTM mode. Change-Id: Ia27dbe5922755a94e80ddc1c5824b8082ae3325a CRs-Fixed: 2051888 --- core/hdd/src/wlan_hdd_cfg80211.c | 6 ++++++ core/hdd/src/wlan_hdd_main.c | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index c65af76cca9c..065615eb8a1d 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -16994,6 +16994,12 @@ static int __wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, int buf_len; void *buf; QDF_STATUS status; + + if (hdd_get_conparam() != QDF_GLOBAL_FTM_MODE) { + hdd_err("Device is not in FTM mode"); + return -EINVAL; + } + if (!tb[WLAN_HDD_TM_ATTR_DATA]) { hdd_err("WLAN_HDD_TM_ATTR_DATA attribute is invalid"); return -EINVAL; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 417cf8aaf963..85422b44c0b3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -10979,17 +10979,16 @@ static int __con_mode_handler(const char *kmessage, struct kernel_param *kp, enum tQDF_GLOBAL_CON_MODE curr_mode; enum tQDF_ADAPTER_MODE adapter_mode; + hdd_info("con_mode handler: %s", kmessage); + ret = wlan_hdd_validate_context(hdd_ctx); if (ret) return ret; cds_set_load_in_progress(true); - hdd_debug("con_mode handler: %s", kmessage); ret = param_set_int(kmessage, kp); - - if (!(is_con_mode_valid(con_mode))) { hdd_err("invlaid con_mode %d", con_mode); ret = -EINVAL;