wlan: Protect private hostapd ioctls from SSR
Protect private hostapd ioctl functions from accessing uninitialized
or de-allocated data structures while SSR is in progress.
Change-Id: I278cfddf6cc85b8ad9b04adf1d653598724e0f34
CRs-Fixed: 709101
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 5eddeab..b137be3 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -1458,7 +1458,7 @@
#endif /* FEATURE_WLAN_CH_AVOID */
int
-static iw_softap_setparam(struct net_device *dev,
+static __iw_softap_setparam(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -1613,9 +1613,22 @@
return ret;
}
+int
+static iw_softap_setparam(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_setparam(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
int
-static iw_softap_getparam(struct net_device *dev,
+static __iw_softap_getparam(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -1672,6 +1685,19 @@
return ret;
}
+int
+static iw_softap_getparam(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_getparam(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
/* Usage:
BLACK_LIST = 0
WHITE_LIST = 1
@@ -1692,8 +1718,9 @@
eg 2. to delete a mac addr 00:0a:f5:89:89:90 from white list
iwpriv softap.0 modify_acl 0x00 0x0a 0xf5 0x89 0x89 0x90 1 1
*/
-int iw_softap_modify_acl(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+int __iw_softap_modify_acl(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
@@ -1724,10 +1751,23 @@
return ret;
}
+int iw_softap_modify_acl(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_modify_acl(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
int
-static iw_softap_getchannel(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static __iw_softap_getchannel(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
@@ -1737,10 +1777,25 @@
return 0;
}
+
int
-static iw_softap_set_max_tx_power(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static iw_softap_getchannel(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_getchannel(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+int
+static __iw_softap_set_max_tx_power(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
@@ -1770,9 +1825,24 @@
}
int
-static iw_display_data_path_snapshot(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static iw_softap_set_max_tx_power(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_set_max_tx_power(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+
+int
+static __iw_display_data_path_snapshot(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
/* Function intitiating dumping states of
@@ -1788,9 +1858,23 @@
}
int
-static iw_softap_set_tx_power(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static iw_display_data_path_snapshot(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_display_data_path_snapshot(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+int
+static __iw_softap_set_tx_power(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
@@ -1821,6 +1905,20 @@
return 0;
}
+int
+static iw_softap_set_tx_power(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_set_tx_power(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
/**---------------------------------------------------------------------------
\brief iw_softap_set_trafficmonitor() -
@@ -1833,9 +1931,9 @@
--------------------------------------------------------------------------*/
-static int iw_softap_set_trafficmonitor(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int __iw_softap_set_trafficmonitor(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
int *isSetTrafficMon = (int *)extra;
@@ -1893,12 +1991,25 @@
return 0;
}
+static int iw_softap_set_trafficmonitor(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_set_trafficmonitor(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
#define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
int
-static iw_softap_getassoc_stamacaddr(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static __iw_softap_getassoc_stamacaddr(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
hdd_station_info_t *pStaInfo = pHostapdAdapter->aStaInfo;
@@ -1964,6 +2075,20 @@
return ret;
}
+int
+static iw_softap_getassoc_stamacaddr(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_getassoc_stamacaddr(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
/* Usage:
mac addr will be accepted as a 6 octet mac address with each octet inputted in hex
for e.g. 00:0a:f5:11:22:33 will be represented as 0x00 0x0a 0xf5 0x11 0x22 0x33
@@ -1978,9 +2103,9 @@
*/
int
-static iw_softap_disassoc_sta(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static __iw_softap_disassoc_sta(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
v_U8_t *peerMacAddr;
@@ -1999,9 +2124,23 @@
}
int
-static iw_softap_ap_stats(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static iw_softap_disassoc_sta(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_disassoc_sta(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+int
+static __iw_softap_ap_stats(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
WLANTL_TRANSFER_STA_TYPE statBuffer;
@@ -2042,10 +2181,24 @@
return 0;
}
-static int iw_softap_set_channel_range(struct net_device *dev,
+int
+static iw_softap_ap_stats(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_ap_stats(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+static int __iw_softap_set_channel_range(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
@@ -2070,9 +2223,23 @@
return ret;
}
-int iw_softap_get_channel_list(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int iw_softap_set_channel_range(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_set_channel_range(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+
+int __iw_softap_get_channel_list(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
v_U32_t num_channels = 0;
v_U8_t i = 0;
@@ -2160,10 +2327,23 @@
return 0;
}
-static
-int iw_get_genie(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+int iw_softap_get_channel_list(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_get_channel_list(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+static
+int __iw_get_genie(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
@@ -2192,10 +2372,25 @@
EXIT();
return 0;
}
-static
-int iw_get_WPSPBCProbeReqIEs(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+
+static
+int iw_get_genie(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_get_genie(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+static
+int __iw_get_WPSPBCProbeReqIEs(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
sQcSapreq_WPSPBCProbeReqIES_t WPSPBCProbeReqIEs;
@@ -2227,6 +2422,20 @@
return 0;
}
+static
+int iw_get_WPSPBCProbeReqIEs(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_get_WPSPBCProbeReqIEs(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
/**---------------------------------------------------------------------------
\brief __iw_set_auth_hostap() -
@@ -2676,10 +2885,10 @@
return ret;
}
-static int iw_softap_setwpsie(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
+static int __iw_softap_setwpsie(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext;
@@ -3010,10 +3219,24 @@
return halStatus;
}
-static int iw_softap_stopbss(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
+static int iw_softap_setwpsie(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_setwpsie(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+static int __iw_softap_stopbss(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
VOS_STATUS status = VOS_STATUS_SUCCESS;
@@ -3051,10 +3274,24 @@
return (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY;
}
-static int iw_softap_version(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
+static int iw_softap_stopbss(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_stopbss(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+static int __iw_softap_version(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
@@ -3064,6 +3301,20 @@
return 0;
}
+static int iw_softap_version(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_softap_version(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
VOS_STATUS hdd_softap_get_sta_info(hdd_adapter_t *pAdapter, v_U8_t *pBuf, int buf_len)
{
v_U8_t i;
@@ -3227,10 +3478,10 @@
return VOS_STATUS_SUCCESS;
}
-int iw_get_softap_linkspeed(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu,
- char *extra)
+int __iw_get_softap_linkspeed(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
{
hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
@@ -3337,6 +3588,21 @@
return 0;
}
+int iw_get_softap_linkspeed(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu,
+ char *extra)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __iw_get_softap_linkspeed(dev, info, wrqu, extra);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+
static const iw_handler hostapd_handler[] =
{
(iw_handler) NULL, /* SIOCSIWCOMMIT */