diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index f556bc1824d5..07eb75f08ccd 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5045,6 +5045,15 @@ int __iw_get_softap_linkspeed(struct net_device *dev, hdd_notice("wrqu->data.length(%d)", wrqu->data.length); + /* Linkspeed is allowed only for P2P mode */ + if (pHostapdAdapter->device_mode != QDF_P2P_GO_MODE) { + hdd_err("Link Speed is not allowed in Device mode %s(%d)", + hdd_device_mode_to_string( + pHostapdAdapter->device_mode), + pHostapdAdapter->device_mode); + return -ENOTSUPP; + } + if (wrqu->data.length >= MAC_ADDRESS_STR_LEN - 1) { if (copy_from_user((void *)pmacAddress, wrqu->data.pointer, MAC_ADDRESS_STR_LEN)) { diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 325152d3da28..68fff4a800f0 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -1520,6 +1520,14 @@ int wlan_hdd_get_link_speed(hdd_adapter_t *sta_adapter, uint32_t *link_speed) if (ret) return ret; + /* Linkspeed is allowed only for P2P mode */ + if (sta_adapter->device_mode != QDF_P2P_CLIENT_MODE) { + hdd_err("Link Speed is not allowed in Device mode %s(%d)", + hdd_device_mode_to_string(sta_adapter->device_mode), + sta_adapter->device_mode); + return -ENOTSUPP; + } + if (eConnectionState_Associated != hdd_stactx->conn_info.connState) { /* we are not connected so we don't have a classAstats */ *link_speed = 0;