From 769866eac8a35b69190ba0888afeb660263bf8f3 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Thu, 28 Jun 2018 19:38:06 +0530 Subject: [PATCH] qcacld-3.0: Validate device mode before setting LL_STATS LL_STATS is supported only for STA mode and currently no check is present to validate the device mode while setting the LL_STATS from the vendor command. Allow LL_STATS to be set from the vendor command only for STA mode. Change-Id: I40e9a6beb20524a84d87105455fe9b28cdc50816 CRs-Fixed: 2266936 --- core/hdd/src/wlan_hdd_stats.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 3be1860ffc..14c0e53b42 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -1248,6 +1248,17 @@ __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, if (0 != status) return -EINVAL; + if (hdd_validate_adapter(adapter)) { + hdd_err("Invalid Adapter"); + return -EINVAL; + } + + if (adapter->device_mode != QDF_STA_MODE) { + hdd_debug("Cannot set LL_STATS for device mode %d", + adapter->device_mode); + return -EINVAL; + } + if (wlan_cfg80211_nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, (struct nlattr *)data, data_len, @@ -1391,9 +1402,10 @@ int wlan_hdd_ll_stats_get(struct hdd_adapter *adapter, uint32_t req_id, return -EBUSY; } - if (!adapter->is_link_layer_stats_set) - hdd_info("is_link_layer_stats_set: %d; STATs will be all zero", - adapter->is_link_layer_stats_set); + if (!adapter->is_link_layer_stats_set) { + hdd_info("LL_STATs not set"); + return -EINVAL; + } get_req.reqId = req_id; get_req.paramIdMask = req_mask;