From 9bf4a34f73a5988c0f872fa4465a84d6ff631da5 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Wed, 13 Nov 2019 17:35:03 +0100 Subject: [PATCH] adopt upstream: net: Fix inconsistent teardown --- os_dep/linux/ioctl_cfg80211.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 744ce36..7f77463 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4697,6 +4697,11 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; strncpy(mon_ndev->name, name, IFNAMSIZ); mon_ndev->name[IFNAMSIZ - 1] = 0; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12 ,0)) + mon_ndev->needs_free_netdev = true; +#else + mon_ndev->destructor = rtw_ndev_destructor; +#endif #if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 11, 8)) mon_ndev->priv_destructor = rtw_ndev_destructor; #else @@ -4916,10 +4921,8 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); /* struct sta_priv *pstapriv = &padapter->stapriv; */ - RTW_INFO("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE) return -EINVAL; @@ -4937,7 +4940,6 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co if (!pbuf) return -ENOMEM; - /* _rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); */ /* if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) */ @@ -4996,7 +4998,6 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co } else ret = -EINVAL; - rtw_mfree(pbuf, head_len + tail_len); return ret; @@ -5074,7 +5075,6 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev, ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len, settings->beacon.tail, settings->beacon.tail_len); - // In cases like WPS, the proberesp and assocresp IEs vary from the beacon, and need to be explicitly set if(ret == 0) { if(settings->beacon.proberesp_ies && settings->beacon.proberesp_ies_len > 0) { @@ -5564,7 +5564,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev return -EINVAL; } - if (!target_mac) { RTW_INFO("flush all sta, and cam_entry\n"); @@ -5576,7 +5575,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev return ret; } - RTW_INFO("free sta macaddr =" MAC_FMT "\n", MAC_ARG(target_mac)); if (target_mac[0] == 0xff && target_mac[1] == 0xff && @@ -5584,7 +5582,6 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev target_mac[4] == 0xff && target_mac[5] == 0xff) return -EINVAL; - _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); phead = &pstapriv->asoc_list; @@ -5754,7 +5751,7 @@ release_plink_ctl: if (del_sta) { u8 sta_addr[ETH_ALEN]; u8 updated = _FALSE; - + _rtw_memcpy(sta_addr, del_sta->cmn.mac_addr, ETH_ALEN); updated = ap_free_sta(adapter, del_sta, 0, 0, 1); rtw_mesh_expire_peer(stapriv->padapter, sta_addr); @@ -5839,7 +5836,7 @@ static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde else _rtw_memcpy(mac, plink->addr, ETH_ALEN); #endif - + sinfo->filled = 0; if (psta) { @@ -6384,7 +6381,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr)); size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); - RTW_INFO("[%s] In\n", __FUNCTION__); /* prepare for building provision_request frame */ @@ -6418,7 +6414,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, break; } - if (rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen)) { rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO, devinfo_content, &devinfo_contentlen); @@ -6426,7 +6421,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, } - /* start to build provision_request frame */ _rtw_memset(wpsie, 0, sizeof(wpsie)); _rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); @@ -6436,7 +6430,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, if (pmgntframe == NULL) return; - /* update attribute */ pattrib = &pmgntframe->attrib; update_mgntframe_attrib(padapter, pattrib); @@ -6466,7 +6459,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, pframe = rtw_set_fixed_ie(pframe, 1, &(oui_subtype), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); - /* build_prov_disc_request_p2p_ie */ /* P2P OUI */ p2pielen = 0; @@ -6496,7 +6488,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, _rtw_memcpy(p2p_ie + p2pielen, &capability, 2); p2pielen += 2; - /* Device Info ATTR */ /* Type: */ p2p_ie[p2pielen++] = P2P_ATTR_DEVICE_INFO; @@ -6512,7 +6503,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen); p2pielen += devinfo_contentlen; - pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); /* p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr); */ /* pframe += p2pielen; */ @@ -6550,7 +6540,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); - #ifdef CONFIG_WFD wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe); pframe += wfdielen;