adopt upstream: net: Fix inconsistent teardown

This commit is contained in:
kimocoder 2019-11-13 17:35:03 +01:00
parent 9248e99dcc
commit 9bf4a34f73

View File

@ -4697,6 +4697,11 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne
mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
strncpy(mon_ndev->name, name, IFNAMSIZ); strncpy(mon_ndev->name, name, IFNAMSIZ);
mon_ndev->name[IFNAMSIZ - 1] = 0; 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)) #if (LINUX_VERSION_CODE > KERNEL_VERSION(4, 11, 8))
mon_ndev->priv_destructor = rtw_ndev_destructor; mon_ndev->priv_destructor = rtw_ndev_destructor;
#else #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 mlme_priv *pmlmepriv = &(adapter->mlmepriv);
/* struct sta_priv *pstapriv = &padapter->stapriv; */ /* struct sta_priv *pstapriv = &padapter->stapriv; */
RTW_INFO("%s beacon_head_len=%zu, beacon_tail_len=%zu\n", __FUNCTION__, head_len, tail_len); 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) if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != _TRUE)
return -EINVAL; return -EINVAL;
@ -4937,7 +4940,6 @@ static int rtw_add_beacon(_adapter *adapter, const u8 *head, size_t head_len, co
if (!pbuf) if (!pbuf)
return -ENOMEM; return -ENOMEM;
/* _rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); */ /* _rtw_memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); */
/* if((pstapriv->max_num_sta>NUM_STA) || (pstapriv->max_num_sta<=0)) */ /* 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 } else
ret = -EINVAL; ret = -EINVAL;
rtw_mfree(pbuf, head_len + tail_len); rtw_mfree(pbuf, head_len + tail_len);
return ret; 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, ret = rtw_add_beacon(adapter, settings->beacon.head, settings->beacon.head_len,
settings->beacon.tail, settings->beacon.tail_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 // In cases like WPS, the proberesp and assocresp IEs vary from the beacon, and need to be explicitly set
if(ret == 0) { if(ret == 0) {
if(settings->beacon.proberesp_ies && settings->beacon.proberesp_ies_len > 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; return -EINVAL;
} }
if (!target_mac) { if (!target_mac) {
RTW_INFO("flush all sta, and cam_entry\n"); 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; return ret;
} }
RTW_INFO("free sta macaddr =" MAC_FMT "\n", MAC_ARG(target_mac)); RTW_INFO("free sta macaddr =" MAC_FMT "\n", MAC_ARG(target_mac));
if (target_mac[0] == 0xff && target_mac[1] == 0xff && 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) target_mac[4] == 0xff && target_mac[5] == 0xff)
return -EINVAL; return -EINVAL;
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
phead = &pstapriv->asoc_list; phead = &pstapriv->asoc_list;
@ -5754,7 +5751,7 @@ release_plink_ctl:
if (del_sta) { if (del_sta) {
u8 sta_addr[ETH_ALEN]; u8 sta_addr[ETH_ALEN];
u8 updated = _FALSE; u8 updated = _FALSE;
_rtw_memcpy(sta_addr, del_sta->cmn.mac_addr, ETH_ALEN); _rtw_memcpy(sta_addr, del_sta->cmn.mac_addr, ETH_ALEN);
updated = ap_free_sta(adapter, del_sta, 0, 0, 1); updated = ap_free_sta(adapter, del_sta, 0, 0, 1);
rtw_mesh_expire_peer(stapriv->padapter, sta_addr); 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 else
_rtw_memcpy(mac, plink->addr, ETH_ALEN); _rtw_memcpy(mac, plink->addr, ETH_ALEN);
#endif #endif
sinfo->filled = 0; sinfo->filled = 0;
if (psta) { 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)); u8 *frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr));
size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr); size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr);
RTW_INFO("[%s] In\n", __FUNCTION__); RTW_INFO("[%s] In\n", __FUNCTION__);
/* prepare for building provision_request frame */ /* prepare for building provision_request frame */
@ -6418,7 +6414,6 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf,
break; break;
} }
if (rtw_get_p2p_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, frame_body_len - _PUBLIC_ACTION_IE_OFFSET_, p2p_ie, &p2p_ielen)) { 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); 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 */ /* start to build provision_request frame */
_rtw_memset(wpsie, 0, sizeof(wpsie)); _rtw_memset(wpsie, 0, sizeof(wpsie));
_rtw_memset(p2p_ie, 0, sizeof(p2p_ie)); _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) if (pmgntframe == NULL)
return; return;
/* update attribute */ /* update attribute */
pattrib = &pmgntframe->attrib; pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib); 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, &(oui_subtype), &(pattrib->pktlen));
pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 1, &(dialogToken), &(pattrib->pktlen));
/* build_prov_disc_request_p2p_ie */ /* build_prov_disc_request_p2p_ie */
/* P2P OUI */ /* P2P OUI */
p2pielen = 0; 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); _rtw_memcpy(p2p_ie + p2pielen, &capability, 2);
p2pielen += 2; p2pielen += 2;
/* Device Info ATTR */ /* Device Info ATTR */
/* Type: */ /* Type: */
p2p_ie[p2pielen++] = P2P_ATTR_DEVICE_INFO; 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); _rtw_memcpy(p2p_ie + p2pielen, devinfo_content, devinfo_contentlen);
p2pielen += devinfo_contentlen; p2pielen += devinfo_contentlen;
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, p2pielen, (unsigned char *) p2p_ie, &p2p_ielen); 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); */ /* p2pielen = build_prov_disc_request_p2p_ie( pwdinfo, pframe, NULL, 0, pwdinfo->tx_prov_disc_info.peerDevAddr); */
/* pframe += p2pielen; */ /* 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); pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen);
#ifdef CONFIG_WFD #ifdef CONFIG_WFD
wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe); wfdielen = build_provdisc_req_wfd_ie(pwdinfo, pframe);
pframe += wfdielen; pframe += wfdielen;