summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinay Krishna Eranna <c_veran@qti.qualcomm.com>2014-03-27 10:51:14 -0700
committerAkash Patel <c_akashp@qca.qualcomm.com>2014-04-09 22:13:55 -0700
commit207a33cf102b8a149a04f0a9a7e296afa7abc26d (patch)
treee18efc5bc85e0414fb66a977fdfb4ebdeefb971a
parent97e61005d00f40b01fc7064aa19661ea2b0d7548 (diff)
wlan: Fix for unregistering IPv4 notifier rightly.
Correct the register and unregister sequence of IPv4 notifier block Change-Id: Icbb9765e6733e5a13922a755b87fe6ceb63240a0 CRs-Fixed: 639818
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h1
-rw-r--r--CORE/HDD/src/wlan_hdd_early_suspend.c24
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c8
3 files changed, 30 insertions, 3 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index faf1cc094e39..b9f08e4856d2 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -896,6 +896,7 @@ struct hdd_adapter_s
/** IPv4 notifier callback for handling ARP offload on change in IP */
struct notifier_block ipv4_notifier;
+ bool ipv4_notifier_registered;
struct work_struct ipv4NotifierWorkQueue;
//TODO Move this to sta Ctx
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index a27f10693385..82252cda3337 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -749,9 +749,17 @@ static int wlan_hdd_ipv4_changed(struct notifier_block *nb,
struct net_device *ndev = ifa->ifa_dev->dev;
hdd_adapter_t *pAdapter =
container_of(nb, struct hdd_adapter_s, ipv4_notifier);
-
+ hdd_context_t *pHddCtx;
+ int status;
if (pAdapter && pAdapter->dev == ndev)
{
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+ if (0 != status)
+ {
+ hddLog(LOGE, FL("HDD context is invalid"));
+ return NOTIFY_DONE;
+ }
if ((in_dev = __in_dev_get_rtnl(pAdapter->dev)) != NULL)
{
for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
@@ -860,7 +868,7 @@ VOS_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, int fenable)
hddLog(VOS_TRACE_LEVEL_INFO, FL("IP Address is not assigned\n"));
}
- if (fenable == 1)
+ if (fenable == 1 && !pAdapter->ipv4_notifier_registered)
{
// Register IPv4 notifier to notify if any change in IP
// So that we can reconfigure the offload parameters
@@ -871,12 +879,22 @@ VOS_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, int fenable)
{
hddLog(LOGE, FL("Failed to register IPv4 notifier"));
}
+ else
+ {
+ hddLog(LOG1, FL("Registered IPv4 notifier"));
+ pAdapter->ipv4_notifier_registered = true;
+ }
}
return VOS_STATUS_SUCCESS;
}
else
{
- unregister_inetaddr_notifier(&pAdapter->ipv4_notifier);
+ if (pAdapter->ipv4_notifier_registered)
+ {
+ hddLog(LOG1, FL("Unregistered IPv4 notifier"));
+ unregister_inetaddr_notifier(&pAdapter->ipv4_notifier);
+ pAdapter->ipv4_notifier_registered = false;
+ }
vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq));
offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
offLoadRequest.offloadType = SIR_IPV4_ARP_REPLY_OFFLOAD;
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 8d433693b23d..6ee97015557c 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -83,6 +83,8 @@
#include <linux/wireless.h>
#include <net/cfg80211.h>
+#include <linux/inetdevice.h>
+#include <net/addrconf.h>
#include "wlan_hdd_cfg80211.h"
#include "wlan_hdd_p2p.h"
#include <linux/rtnetlink.h>
@@ -8195,6 +8197,12 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter )
}
}
+ if (pAdapter->ipv4_notifier_registered)
+ {
+ hddLog(LOG1, FL("Unregistered IPv4 notifier"));
+ unregister_inetaddr_notifier(&pAdapter->ipv4_notifier);
+ pAdapter->ipv4_notifier_registered = false;
+ }
#ifdef WLAN_OPEN_SOURCE
cancel_work_sync(&pAdapter->ipv4NotifierWorkQueue);
#endif