wlan: Protect cfg80211 netdev ops and wext ioctls from SSR
Protect cfg80211, netdev ops functions and hostapd, wext ioctls from
accessing uninitialized or de-allocated data structures while SSR is
in progress.
Change-Id: I0c41da99ac245ed8b5580246f3e79f3a02ba2051
CRs-Fixed: 772343
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index b484065..e6ac32a 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -6081,10 +6081,10 @@
}
/**
- * FUNCTION: wlan_hdd_cfg80211_set_channel
+ * FUNCTION: __wlan_hdd_cfg80211_set_channel
* This function is used to set the channel number
*/
-static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev,
+static int __wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type
)
@@ -6233,6 +6233,21 @@
return status;
}
+static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy,
+ struct net_device *dev,
+ struct ieee80211_channel *chan,
+ enum nl80211_channel_type channel_type
+ )
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
struct beacon_parameters *params)
@@ -7944,7 +7959,7 @@
}
#endif
-static int wlan_hdd_change_station(struct wiphy *wiphy,
+static int __wlan_hdd_change_station(struct wiphy *wiphy,
struct net_device *dev,
u8 *mac,
struct station_parameters *params)
@@ -8117,6 +8132,20 @@
return status;
}
+static int wlan_hdd_change_station(struct wiphy *wiphy,
+ struct net_device *dev,
+ u8 *mac,
+ struct station_parameters *params)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_change_station(wiphy, dev, mac, params);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
/*
* FUNCTION: __wlan_hdd_cfg80211_add_key
* This function is used to initialize the key information
@@ -8647,18 +8676,18 @@
}
/*
- * FUNCTION: wlan_hdd_cfg80211_del_key
+ * FUNCTION: __wlan_hdd_cfg80211_del_key
* This function is used to delete the key information
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index,
bool pairwise,
const u8 *mac_addr
)
#else
-static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
struct net_device *ndev,
u8 key_index,
const u8 *mac_addr
@@ -8755,6 +8784,35 @@
return status;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+ struct net_device *ndev,
+ u8 key_index,
+ bool pairwise,
+ const u8 *mac_addr
+ )
+#else
+static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy,
+ struct net_device *ndev,
+ u8 key_index,
+ const u8 *mac_addr
+ )
+#endif
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+ ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise,
+ mac_addr);
+#else
+ ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr);
+#endif
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
/*
* FUNCTION: __wlan_hdd_cfg80211_set_default_key
* This function is used to set the default tx key index
@@ -12218,10 +12276,10 @@
}
/*
- * FUNCTION: wlan_hdd_cfg80211_get_txpower
+ * FUNCTION: __wlan_hdd_cfg80211_get_txpower
* This function is used to read the txpower
*/
-static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
+static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
struct wireless_dev *wdev,
#endif
@@ -12258,6 +12316,26 @@
return 0;
}
+static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ struct wireless_dev *wdev,
+#endif
+ int *dbm)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_cfg80211_get_txpower(wiphy,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ wdev,
+#endif
+ dbm);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+
static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
u8* mac, struct station_info *sinfo)
{
@@ -12802,9 +12880,37 @@
return ret;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
+ struct net_device *netdev,
+ u8 key_index)
+{
+ ENTER();
+ return 0;
+}
+
static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *netdev,
- u8 key_index)
+ struct net_device *netdev,
+ u8 key_index)
+{
+ int ret;
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index);
+ vos_ssr_unprotect(__func__);
+ return ret;
+}
+#endif //LINUX_VERSION_CODE
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+static int __wlan_hdd_set_txq_params(struct wiphy *wiphy,
+ struct net_device *dev,
+ struct ieee80211_txq_params *params)
+{
+ ENTER();
+ return 0;
+}
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
+static int __wlan_hdd_set_txq_params(struct wiphy *wiphy,
+ struct ieee80211_txq_params *params)
{
ENTER();
return 0;
@@ -12813,20 +12919,28 @@
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
- struct net_device *dev,
- struct ieee80211_txq_params *params)
+ struct net_device *dev,
+ struct ieee80211_txq_params *params)
{
- ENTER();
- return 0;
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_set_txq_params(wiphy, dev, params);
+ vos_ssr_unprotect(__func__);
+ return ret;
}
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
struct ieee80211_txq_params *params)
{
- ENTER();
- return 0;
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_set_txq_params(wiphy, params);
+ vos_ssr_unprotect(__func__);
+ return ret;
}
-#endif //LINUX_VERSION_CODE
+#endif
static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
struct net_device *dev,
@@ -12963,6 +13077,7 @@
#ifdef CFG80211_DEL_STA_V2
if (NULL == param) {
hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__);
+ vos_ssr_unprotect(__func__);
return -EINVAL;
}
@@ -13820,11 +13935,11 @@
#ifdef FEATURE_WLAN_TDLS
#if TDLS_MGMT_VERSION2
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
u8 *peer, u8 action_code, u8 dialog_token,
u16 status_code, u32 peer_capability, const u8 *buf, size_t len)
#else
-static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
u8 *peer, u8 action_code, u8 dialog_token,
u16 status_code, const u8 *buf, size_t len)
#endif
@@ -14060,6 +14175,31 @@
return 0;
}
+#if TDLS_MGMT_VERSION2
+static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+ u8 *peer, u8 action_code, u8 dialog_token,
+ u16 status_code, u32 peer_capability,
+ const u8 *buf, size_t len)
+#else
+static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
+ u8 *peer, u8 action_code, u8 dialog_token,
+ u16 status_code, const u8 *buf, size_t len)
+#endif
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+#if TDLS_MGMT_VERSION2
+ ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token,
+ status_code, peer_capability, buf, len);
+#else
+ ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token,
+ status_code, buf, len);
+#endif
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter,
u8 *peer,
@@ -14601,11 +14741,12 @@
}
#endif /*WLAN_FEATURE_GTK_OFFLOAD*/
/*
- * FUNCTION: wlan_hdd_cfg80211_set_mac_acl
+ * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl
* This function is used to set access control policy
*/
-static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
- struct net_device *dev, const struct cfg80211_acl_data *params)
+static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
+ struct net_device *dev,
+ const struct cfg80211_acl_data *params)
{
int i;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -14733,6 +14874,18 @@
return 0;
}
+static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
+ struct net_device *dev,
+ const struct cfg80211_acl_data *params)
+{
+ int ret;
+ vos_ssr_protect(__func__);
+ ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
#ifdef WLAN_NL80211_TESTMODE
#ifdef FEATURE_WLAN_LPHB
void wlan_hdd_cfg80211_lphb_ind_handler