diff options
| author | Vinay Krishna Eranna <c_veran@qti.qualcomm.com> | 2015-07-23 22:35:12 -0700 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2015-08-24 17:55:22 +0530 |
| commit | 16a42c95e0444f2f490ff2d531c09d64cbfd2cff (patch) | |
| tree | fc0638c16ee73e4421fafe5a9b7405d29f7ebad7 | |
| parent | 275a504d3b5102c84827e728472eb0d616492284 (diff) | |
qcacld-2.0: Extract the Adapter context from notifier block argument
This is a prima to qcacld-2.0 propagation.
Current implementation of IP notifier extracts adapter context
from the net device structure and then interpret it. The
notifier can be called for different interface other than the one
the driver is interested in, which leads interpreting an invalid
address as the valid adapter context.
Avoid this by extracting the relevant information using the
notifier block argument passed to the IP notifier callback.
Change-Id: Iaf1529b393e5433790baf60985fed7662cf5e92f
CRs-Fixed: 791657
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_early_suspend.c | 154 |
1 files changed, 80 insertions, 74 deletions
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c index 111be5f624e6..48bee6702f91 100644 --- a/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -550,34 +550,39 @@ void hdd_conf_gtk_offload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ #ifdef WLAN_NS_OFFLOAD + static int __wlan_hdd_ipv6_changed(struct notifier_block *nb, - unsigned long data, void *arg) + unsigned long data, void *arg) { - struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg; - struct net_device *ndev = ifa->idev->dev; - hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(ndev); - hdd_context_t *pHddCtx; - int status; - - ENTER(); - - if (pAdapter && pAdapter->dev == ndev && - (pAdapter->device_mode == WLAN_HDD_INFRA_STATION || - pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { - pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - status = wlan_hdd_validate_context(pHddCtx); - if (0 != status) - return NOTIFY_DONE; - - if (pHddCtx->cfg_ini->nEnableSuspend == - WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER) - schedule_work(&pAdapter->ipv6NotifierWorkQueue); - else - hddLog(LOG1, FL("Not scheduling ipv6 wq nEnableSuspend = %d"), - pHddCtx->cfg_ini->nEnableSuspend); - } - EXIT(); - return NOTIFY_DONE; + struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg; + struct net_device *ndev = ifa->idev->dev; + hdd_context_t *hdd_ctx; + hdd_adapter_t *adapter; + int status; + + hdd_ctx = container_of(nb, hdd_context_t, ipv6_notifier); + status = wlan_hdd_validate_context(hdd_ctx); + if (0 != status) { + hddLog(LOGE, FL("HDD context is invalid")); + return NOTIFY_DONE; + } + + adapter = WLAN_HDD_GET_PRIV_PTR(ndev); + if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) return NOTIFY_DONE; + if (adapter->dev != ndev) return NOTIFY_DONE; + if (WLAN_HDD_GET_CTX(adapter) != hdd_ctx) return NOTIFY_DONE; + + if (adapter->device_mode == WLAN_HDD_INFRA_STATION || + (adapter->device_mode == WLAN_HDD_P2P_CLIENT)) { + if (hdd_ctx->cfg_ini->nEnableSuspend == + WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER) + schedule_work(&adapter->ipv6NotifierWorkQueue); + else + hddLog(LOG1, FL("Not scheduling ipv6 wq nEnableSuspend: %d"), + hdd_ctx->cfg_ini->nEnableSuspend); + } + + return NOTIFY_DONE; } /** @@ -1030,55 +1035,56 @@ void hdd_ipv4_notifier_work_queue(struct work_struct *work) } static int __wlan_hdd_ipv4_changed(struct notifier_block *nb, - unsigned long data, void *arg) + unsigned long data, void *arg) { - struct in_ifaddr *ifa = (struct in_ifaddr *)arg; - struct in_ifaddr **ifap = NULL; - struct in_device *in_dev; - - struct net_device *ndev = ifa->ifa_dev->dev; - hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(ndev); - hdd_context_t *pHddCtx; - int status; - - ENTER(); - - if (pAdapter && pAdapter->dev == ndev && - (pAdapter->device_mode == WLAN_HDD_INFRA_STATION || - pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { - pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - status = wlan_hdd_validate_context(pHddCtx); - if (0 != status) - return NOTIFY_DONE; - - if ((pHddCtx->cfg_ini->nEnableSuspend != - WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER) || - (!pHddCtx->cfg_ini->fhostArpOffload)) { - hddLog(LOG1, FL("Offload not enabled MCBC=%d, ARPOffload=%d"), - pHddCtx->cfg_ini->nEnableSuspend, - pHddCtx->cfg_ini->fhostArpOffload); - - return NOTIFY_DONE; - } - - if ((in_dev = __in_dev_get_rtnl(pAdapter->dev)) != NULL) - { - for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; - ifap = &ifa->ifa_next) - { - if (!strcmp(pAdapter->dev->name, ifa->ifa_label)) - { - break; /* found */ - } - } - } - if(ifa && ifa->ifa_local) - { - schedule_work(&pAdapter->ipv4NotifierWorkQueue); - } - } - EXIT(); - return NOTIFY_DONE; + struct in_ifaddr *ifa = (struct in_ifaddr *)arg; + struct in_ifaddr **ifap = NULL; + struct in_device *in_dev; + struct net_device *ndev = ifa->ifa_dev->dev; + hdd_context_t *hdd_ctx; + hdd_adapter_t *adapter; + int status; + + hdd_ctx = container_of(nb, hdd_context_t, ipv4_notifier); + status = wlan_hdd_validate_context(hdd_ctx); + if (0 != status) { + hddLog(LOGE, FL("HDD context is invalid")); + return NOTIFY_DONE; + } + + adapter = WLAN_HDD_GET_PRIV_PTR(ndev); + if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) return NOTIFY_DONE; + if (adapter->dev != ndev) return NOTIFY_DONE; + if (WLAN_HDD_GET_CTX(adapter) != hdd_ctx) return NOTIFY_DONE; + + if (adapter->device_mode == WLAN_HDD_INFRA_STATION || + adapter->device_mode == WLAN_HDD_P2P_CLIENT) { + if ((hdd_ctx->cfg_ini->nEnableSuspend != + WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER) || + (!hdd_ctx->cfg_ini->fhostArpOffload)) { + hddLog(LOG1, FL("Offload not enabled MCBC=%d, ARPOffload=%d"), + hdd_ctx->cfg_ini->nEnableSuspend, + hdd_ctx->cfg_ini->fhostArpOffload); + + return NOTIFY_DONE; + } + } + + in_dev = __in_dev_get_rtnl(adapter->dev); + if (in_dev != NULL) { + for (ifap = &in_dev->ifa_list; + (ifa = *ifap) != NULL; + ifap = &ifa->ifa_next) { + if (!strcmp(adapter->dev->name, + ifa->ifa_label)) + break; /* found */ + } + } + + if (ifa && ifa->ifa_local) + schedule_work(&adapter->ipv4NotifierWorkQueue); + + return NOTIFY_DONE; } /** |
