wlan: Protect netdev ops functions from SSR
Protect netdev ops functions from accessing deallocated or
un-initialized data structures while SSR is in progress.
Change-Id: I2143de20289baef9e7dab0582180e6370575c253
CRs-Fixed: 728525
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 28e009a..566c60c 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4143,7 +4143,7 @@
return ret;
}
-int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+int __hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
hdd_adapter_t *pAdapter;
hdd_context_t *pHddCtx;
@@ -4194,6 +4194,17 @@
return ret;
}
+int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __hdd_ioctl(dev, ifr, cmd);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
/**---------------------------------------------------------------------------
@@ -5019,16 +5030,14 @@
/**---------------------------------------------------------------------------
- \brief hdd_open() - HDD Open function
-
- This is called in response to ifconfig up
+ \brief __hdd_open() - HDD Open function
\param - dev Pointer to net_device structure
\return - 0 for success non-zero for failure
--------------------------------------------------------------------------*/
-int hdd_open (struct net_device *dev)
+int __hdd_open(struct net_device *dev)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx;
@@ -5092,6 +5101,28 @@
return 0;
}
+/**---------------------------------------------------------------------------
+
+ \brief hdd_open() - Wrapper function for __hdd_open to protect it from SSR
+
+ This is called in response to ifconfig up
+
+ \param - dev Pointer to net_device structure
+
+ \return - 0 for success non-zero for failure
+
+ --------------------------------------------------------------------------*/
+int hdd_open(struct net_device *dev)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __hdd_open(dev);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
int hdd_mon_open (struct net_device *dev)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -5108,9 +5139,7 @@
}
/**---------------------------------------------------------------------------
- \brief hdd_stop() - HDD stop function
-
- This is called in response to ifconfig down
+ \brief __hdd_stop() - HDD stop function
\param - dev Pointer to net_device structure
@@ -5118,7 +5147,7 @@
--------------------------------------------------------------------------*/
-int hdd_stop (struct net_device *dev)
+int __hdd_stop (struct net_device *dev)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx;
@@ -5227,17 +5256,35 @@
/**---------------------------------------------------------------------------
- \brief hdd_uninit() - HDD uninit function
+ \brief hdd_stop() - wrapper_function for __hdd_stop to protect it from SSR
- This is called during the netdev unregister to uninitialize all data
-associated with the device
+ This is called in response to ifconfig down
+
+ \param - dev Pointer to net_device structure
+
+ \return - 0 for success non-zero for failure
+-----------------------------------------------------------------------------*/
+int hdd_stop (struct net_device *dev)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __hdd_stop(dev);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
+/**---------------------------------------------------------------------------
+
+ \brief __hdd_uninit() - HDD uninit function
\param - dev Pointer to net_device structure
\return - void
--------------------------------------------------------------------------*/
-static void hdd_uninit (struct net_device *dev)
+static void __hdd_uninit (struct net_device *dev)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -5285,6 +5332,25 @@
/**---------------------------------------------------------------------------
+ \brief hdd_uninit() - Wrapper function to protect __hdd_uninit from SSR
+
+ This is called during the netdev unregister to uninitialize all data
+associated with the device
+
+ \param - dev Pointer to net_device structure
+
+ \return - void
+
+ --------------------------------------------------------------------------*/
+static void hdd_uninit (struct net_device *dev)
+{
+ vos_ssr_protect(__func__);
+ __hdd_uninit(dev);
+ vos_ssr_unprotect(__func__);
+}
+
+/**---------------------------------------------------------------------------
+
\brief hdd_release_firmware() -
This function calls the release firmware API to free the firmware buffer.
@@ -5532,7 +5598,7 @@
/**---------------------------------------------------------------------------
- \brief hdd_set_mac_address() -
+ \brief __hdd_set_mac_address() -
This function sets the user specified mac address using
the command ifconfig wlanX hw ether <mac adress>.
@@ -5543,7 +5609,7 @@
--------------------------------------------------------------------------*/
-static int hdd_set_mac_address(struct net_device *dev, void *addr)
+static int __hdd_set_mac_address(struct net_device *dev, void *addr)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
struct sockaddr *psta_mac_addr = addr;
@@ -5558,6 +5624,28 @@
return halStatus;
}
+/**---------------------------------------------------------------------------
+
+ \brief hdd_set_mac_address() -
+
+ Wrapper function to protect __hdd_set_mac_address() function from ssr
+
+ \param - dev - Pointer to the net device.
+ - addr - Pointer to the sockaddr.
+ \return - 0 for success, non zero for failure
+
+ --------------------------------------------------------------------------*/
+static int hdd_set_mac_address(struct net_device *dev, void *addr)
+{
+ int ret;
+
+ vos_ssr_protect(__func__);
+ ret = __hdd_set_mac_address(dev, addr);
+ vos_ssr_unprotect(__func__);
+
+ return ret;
+}
+
tANI_U8* wlan_hdd_get_intf_addr(hdd_context_t* pHddCtx)
{
int i;
@@ -7431,7 +7519,7 @@
}
/**---------------------------------------------------------------------------
- \brief hdd_select_queue() -
+ \brief hdd_get_operating_channel() -
This API returns the operating channel of the requested device mode