diff --git a/README.md b/README.md index fcd7505..0444b73 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # REALTEK RTL88x2B USB Linux Driver -**Current Driver Version**: 5.6.1.5 +**Current Driver Version**: 5.6.1.6 **Support Kernel**: 2.6.24 ~ 5.4 (with unofficial patches) Official release note please check ReleaseNotes.pdf diff --git a/ReleaseNotes.pdf b/ReleaseNotes.pdf index a3b3762..1810921 100644 Binary files a/ReleaseNotes.pdf and b/ReleaseNotes.pdf differ diff --git a/core/mesh/rtw_mesh.o b/core/mesh/rtw_mesh.o deleted file mode 100644 index 5b4f629..0000000 Binary files a/core/mesh/rtw_mesh.o and /dev/null differ diff --git a/core/mesh/rtw_mesh_hwmp.o b/core/mesh/rtw_mesh_hwmp.o deleted file mode 100644 index 4edb55c..0000000 Binary files a/core/mesh/rtw_mesh_hwmp.o and /dev/null differ diff --git a/core/mesh/rtw_mesh_pathtbl.o b/core/mesh/rtw_mesh_pathtbl.o deleted file mode 100644 index 9f9df62..0000000 Binary files a/core/mesh/rtw_mesh_pathtbl.o and /dev/null differ diff --git a/core/rtw_ap.c b/core/rtw_ap.c index a03a71a..1f8081c 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -1787,7 +1787,7 @@ chbw_decision: , pdvobj->padapters[i]->mlmeextpriv.cur_channel , pdvobj->padapters[i]->mlmeextpriv.cur_bwmode , pdvobj->padapters[i]->mlmeextpriv.cur_ch_offset - , ht_option); + , ht_option, 0); } } #endif /* defined(CONFIG_IOCTL_CFG80211) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) */ diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 33b05c4..93169ff 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -1191,6 +1191,62 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 return NULL; } +/* OWE */ + +/** + * rtw_get_OWE_ie - Search OWE IE from a series of IEs + * @in_ie: Address of IEs to search + * @in_len: Length limit from in_ie + * @wps_ie: If not NULL and OWE IE is found, OWE IE will be copied to the buf starting from owe_ie + * @wps_ielen: If not NULL and OWE IE is found, will set to the length of the entire OWE IE + * + * Returns: The address of the OWE IE found, or NULL + */ +u8 *rtw_get_owe_ie(const u8 *in_ie, uint in_len, u8 *owe_ie, uint *owe_ielen) +{ + uint cnt; + const u8 *oweie_ptr = NULL; + u8 eid; + + if (owe_ielen) + *owe_ielen = 0; + + if (!in_ie) { + rtw_warn_on(1); + return (u8 *)oweie_ptr; + } + + if (in_len <= 0) + return (u8 *)oweie_ptr; + + cnt = 0; + + while (cnt + 1 + 4 < in_len) { + eid = in_ie[cnt]; + + if (cnt + 1 + 4 >= MAX_IE_SZ) { + rtw_warn_on(1); + return NULL; + } + + if ((eid == WLAN_EID_EXTENSION) && (in_ie[cnt + 2] == WLAN_EID_EXT_OWE_DH_PARAM)) { + oweie_ptr = in_ie + cnt; + + if (owe_ie) + _rtw_memcpy(owe_ie, &in_ie[cnt], in_ie[cnt + 1] + 2); + + if (owe_ielen) + *owe_ielen = in_ie[cnt + 1] + 2; + + break; + } else + cnt += in_ie[cnt + 1] + 2; + + } + + return (u8 *)oweie_ptr; +} + static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, struct rtw_ieee802_11_elems *elems, int show_errors) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 4cb7b9e..ac83578 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -105,6 +105,7 @@ unsigned char WMM_OUI[] = {0x00, 0x50, 0xf2, 0x02}; unsigned char WPS_OUI[] = {0x00, 0x50, 0xf2, 0x04}; unsigned char P2P_OUI[] = {0x50, 0x6F, 0x9A, 0x09}; unsigned char WFD_OUI[] = {0x50, 0x6F, 0x9A, 0x0A}; +unsigned char DPP_OUI[] = {0x50, 0x6F, 0x9A, 0x1A}; unsigned char WMM_INFO_OUI[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01}; unsigned char WMM_PARA_OUI[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; @@ -6543,6 +6544,9 @@ unsigned int on_action_public_vendor(union recv_frame *precv_frame) unsigned int ret = _FAIL; u8 *pframe = precv_frame->u.hdr.rx_data; u8 *frame_body = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); + _adapter *adapter = precv_frame->u.hdr.adapter; + int cnt = 0; + char msg[64]; if (_rtw_memcmp(frame_body + 2, P2P_OUI, 4) == _TRUE) { if (rtw_action_public_decache(precv_frame, 7) == _FAIL) @@ -6552,6 +6556,13 @@ unsigned int on_action_public_vendor(union recv_frame *precv_frame) rtw_rframe_del_wfd_ie(precv_frame, 8); ret = on_action_public_p2p(precv_frame); + } else if (_rtw_memcmp(frame_body + 2, DPP_OUI, 4) == _TRUE) { + u8 dpp_type = frame_body[7]; + +#ifdef CONFIG_IOCTL_CFG80211 + cnt += sprintf((msg + cnt), "DPP(type:%u)", dpp_type); + rtw_cfg80211_rx_action(adapter, precv_frame, msg); +#endif } exit: @@ -8937,6 +8948,23 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p #endif } +static u32 rtw_append_assoc_req_owe_ie(_adapter *adapter, u8 *pbuf) +{ + struct security_priv *sec = &adapter->securitypriv; + u32 len = 0; + + if (sec == NULL) + goto exit; + + if (sec->owe_ie && sec->owe_ie_len > 0) { + len = sec->owe_ie_len; + _rtw_memcpy(pbuf, sec->owe_ie, len); + } + +exit: + return len; +} + void _issue_assocreq(_adapter *padapter, u8 is_reassoc) { int ret = _FAIL; @@ -9383,6 +9411,15 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) #endif #endif /* CONFIG_P2P */ + /* OWE */ + { + u32 owe_ie_len; + + owe_ie_len = rtw_append_assoc_req_owe_ie(padapter, pframe); + pframe += owe_ie_len; + pattrib->pktlen += owe_ie_len; + } + #ifdef CONFIG_RTW_REPEATER_SON rtw_rson_append_ie(padapter, pframe, &pattrib->pktlen); #endif @@ -16066,7 +16103,7 @@ void rtw_join_done_chk_ch(_adapter *adapter, int join_res) rtw_cfg80211_ch_switch_notify(iface , mlmeext->cur_channel, mlmeext->cur_bwmode, mlmeext->cur_ch_offset - , ht_option); + , ht_option, 0); #endif } } @@ -16279,12 +16316,12 @@ exit: ht_option = adapter->mlmepriv.htpriv.ht_option; #endif /* CONFIG_80211N_HT */ - /* + /* when supplicant send the mlme frame, the bss freq is updated by channel switch event. */ rtw_cfg80211_ch_switch_notify(adapter, - cur_ch, cur_bw, cur_ch_offset, ht_option); + cur_ch, cur_bw, cur_ch_offset, ht_option, 1); } #endif } diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index b0bd8e7..f66fa71 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -4459,7 +4459,7 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength) u32 ies_len; u8 *p2p_ie; u32 p2p_ielen = 0; - u8 noa_attr[MAX_P2P_IE_LEN] = { 0x00 };/* NoA length should be n*(13) + 2 */ + u8 *noa_attr; /* NoA length should be n*(13) + 2 */ u32 attr_contentlen = 0; struct wifidirect_info *pwdinfo = &(padapter->wdinfo); @@ -4486,7 +4486,8 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength) while (p2p_ie) { find_p2p = _TRUE; /* Get Notice of Absence IE. */ - if (rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_NOA, noa_attr, &attr_contentlen)) { + noa_attr = rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_NOA, NULL, &attr_contentlen); + if (noa_attr) { find_p2p_ps = _TRUE; noa_index = noa_attr[0]; @@ -4499,8 +4500,8 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength) noa_offset = 2; noa_num = 0; /* NoA length should be n*(13) + 2 */ - if (attr_contentlen > 2) { - while (noa_offset < attr_contentlen) { + if (attr_contentlen > 2 && (attr_contentlen - 2) % 13 == 0) { + while (noa_offset < attr_contentlen && noa_num < P2P_MAX_NOA_NUM) { /* _rtw_memcpy(&wifidirect_info->noa_count[noa_num], &noa_attr[noa_offset], 1); */ pwdinfo->noa_count[noa_num] = noa_attr[noa_offset]; noa_offset += 1; diff --git a/hal/phydm/halrf/rtl8822b/halrf_iqk_8822b.c b/hal/phydm/halrf/rtl8822b/halrf_iqk_8822b.c index fcd710f..70e8278 100644 --- a/hal/phydm/halrf/rtl8822b/halrf_iqk_8822b.c +++ b/hal/phydm/halrf/rtl8822b/halrf_iqk_8822b.c @@ -318,13 +318,13 @@ void _iqk_restore_rf_8822b(struct dm_struct *dm, u32 *backup_rf_reg, odm_set_rf_reg(dm, RF_PATH_B, RF_0xef, MASK20BITS, 0x0); /*0xdf[4]=0*/ _iqk_rf_set_check_8822b(dm, RF_PATH_A, 0xdf, - RF_backup[0][RF_PATH_A] & (!BIT(4))); + RF_backup[0][RF_PATH_A] & (~BIT(4))); _iqk_rf_set_check_8822b(dm, RF_PATH_B, 0xdf, - RF_backup[0][RF_PATH_B] & (!BIT(4))); + RF_backup[0][RF_PATH_B] & (~BIT(4))); #if 0 - /*odm_set_rf_reg(dm, RF_PATH_A, RF_0xdf, MASK20BITS, RF_backup[0][RF_PATH_A] & (!BIT(4)));*/ - /*odm_set_rf_reg(dm, RF_PATH_B, RF_0xdf, MASK20BITS, RF_backup[0][RF_PATH_B] & (!BIT(4)));*/ + /*odm_set_rf_reg(dm, RF_PATH_A, RF_0xdf, MASK20BITS, RF_backup[0][RF_PATH_A] & (~BIT(4)));*/ + /*odm_set_rf_reg(dm, RF_PATH_B, RF_0xdf, MASK20BITS, RF_backup[0][RF_PATH_B] & (~BIT(4)));*/ #endif for (i = 1; i < RF_REG_NUM_8822B; i++) { @@ -443,11 +443,11 @@ void _iqk_reload_iqk_setting_8822b(struct dm_struct *dm, u8 ch, odm_write_4byte(dm, 0x1bd8, data); } if (idx == 0) { - report = !(iqk->iqk_fail_report[ch][path][idx]); + report = ~(iqk->iqk_fail_report[ch][path][idx]); odm_set_bb_reg(dm, iqk_apply[path], BIT(0), report); } else { - report = !(iqk->iqk_fail_report[ch][path][idx]); + report = ~(iqk->iqk_fail_report[ch][path][idx]); odm_set_bb_reg(dm, iqk_apply[path], BIT(10), report); } @@ -528,7 +528,7 @@ void _iqk_rf_setting_8822b(struct dm_struct *dm) /*0xdf:B11 = 1,B4 = 0, B1 = 1*/ tmp = odm_get_rf_reg(dm, (enum rf_path)path, RF_0xdf, MASK20BITS); - tmp = (tmp & (!BIT(4))) | BIT(1) | BIT(11); + tmp = (tmp & (~BIT(4))) | BIT(1) | BIT(11); _iqk_rf_set_check_8822b(dm, (enum rf_path)path, 0xdf, tmp); #if 0 /*odm_set_rf_reg(dm, (enum rf_path)path, RF_0xdf, MASK20BITS, tmp);*/ diff --git a/include/ieee80211.h b/include/ieee80211.h index 6fac3d2..92dd317 100644 --- a/include/ieee80211.h +++ b/include/ieee80211.h @@ -813,6 +813,8 @@ struct ieee80211_snap_hdr { #define WLAN_EID_VHT_CAPABILITY 191 #define WLAN_EID_VHT_OPERATION 192 #define WLAN_EID_VHT_OP_MODE_NOTIFY 199 +#define WLAN_EID_EXTENSION 255 +#define WLAN_EID_EXT_OWE_DH_PARAM 32 #define IEEE80211_MGMT_HDR_LEN 24 #define IEEE80211_DATA_HDR3_LEN 24 @@ -1488,6 +1490,7 @@ struct ieee80211_txb { #define MAX_WPA_IE_LEN (256) #define MAX_WPS_IE_LEN (512) +#define MAX_OWE_IE_LEN (128) #define MAX_P2P_IE_LEN (256) #define MAX_WFD_IE_LEN (128) @@ -2113,6 +2116,8 @@ u8 *rtw_get_wps_ie(const u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen); u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_attr, u32 *len_attr); u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_content, uint *len_content); +u8 *rtw_get_owe_ie(const u8 *in_ie, uint in_len, u8 *owe_ie, uint *owe_ielen); + /** * for_each_ie - iterate over continuous IEs * @ie: diff --git a/include/rtl8822b_hal.h b/include/rtl8822b_hal.h index 076f824..68ad970 100644 --- a/include/rtl8822b_hal.h +++ b/include/rtl8822b_hal.h @@ -23,7 +23,11 @@ #ifdef CONFIG_SUPPORT_TRX_SHARED #define MAX_RECVBUF_SZ 46080 /* 45KB, TX: (256-64)KB */ #else /* !CONFIG_SUPPORT_TRX_SHARED */ +#ifdef CONFIG_PCI_HCI +#define MAX_RECVBUF_SZ 12288 /* 12KB */ +#else #define MAX_RECVBUF_SZ 24576 /* 24KB, TX: 256KB */ +#endif /* !CONFIG_PCI_HCI */ #endif /* !CONFIG_SUPPORT_TRX_SHARED */ /* diff --git a/include/rtw_security.h b/include/rtw_security.h index 36756e1..58362eb 100644 --- a/include/rtw_security.h +++ b/include/rtw_security.h @@ -164,6 +164,8 @@ struct security_priv { u8 wps_ie[MAX_WPS_IE_LEN];/* added in assoc req */ int wps_ie_len; + u8 owe_ie[MAX_OWE_IE_LEN];/* added in assoc req */ + int owe_ie_len; u8 binstallGrpkey; #ifdef CONFIG_GTK_OL diff --git a/include/rtw_version.h b/include/rtw_version.h index 0d42bdd..ce229e4 100644 --- a/include/rtw_version.h +++ b/include/rtw_version.h @@ -1,2 +1,2 @@ -#define DRIVERVERSION "v5.6.1.5_33902.20190604_COEX20180928-6a6a" +#define DRIVERVERSION "v5.6.1.6_35492.20191025_COEX20180928-6a6a" #define BTCOEXVERSION "COEX20180928-6a6a" diff --git a/include/wifi.h b/include/wifi.h index d4fc508..9d9c0d7 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -1034,9 +1034,7 @@ typedef enum _HT_CAP_AMPDU_DENSITY { * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) */ #define IEEE80211_MIN_AMPDU_BUF 0x8 -#ifndef IEEE80211_MAX_AMPDU_BUF - #define IEEE80211_MAX_AMPDU_BUF 0x40 -#endif +#define IEEE80211_MAX_AMPDU_BUF_HT 0x40 /* Spatial Multiplexing Power Save Modes */ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c old mode 100644 new mode 100755 index 4967375..b083c52 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -424,7 +424,8 @@ bool rtw_cfg80211_allow_ch_switch_notify(_adapter *adapter) return 1; } -u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht) +u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, + u8 ht, bool started) { struct wiphy *wiphy = adapter_to_wiphy(adapter); u8 ret = _SUCCESS; @@ -432,13 +433,20 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) struct cfg80211_chan_def chdef; - if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) - goto exit; - ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht); if (ret != _SUCCESS) goto exit; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) + if (started) { + cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0); + goto exit; + } +#endif + + if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) + goto exit; + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef); #else @@ -713,9 +721,7 @@ static int rtw_cfg80211_sync_iftype(_adapter *adapter) static u64 rtw_get_systime_us(void) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) - struct timespec ts; - getboottime(&ts); - return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; + return ktime_to_us(ktime_get_boottime()); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct timespec ts; get_monotonic_boottime(&ts); @@ -3560,6 +3566,18 @@ static int rtw_cfg80211_set_wpa_ie(_adapter *padapter, u8 *pie, size_t ielen) _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); } + {/* handle owe_ie */ + uint owe_ielen; + u8 *owe_ie; + + owe_ie = rtw_get_owe_ie(buf, ielen, NULL, &owe_ielen); + if (owe_ie && owe_ielen > 0) { + RTW_INFO("got owe_ie, owe_ielen:%u\n", owe_ielen); + padapter->securitypriv.owe_ie_len = owe_ielen < MAX_OWE_IE_LEN ? owe_ielen : MAX_OWE_IE_LEN; + _rtw_memcpy(padapter->securitypriv.owe_ie, owe_ie, padapter->securitypriv.owe_ie_len); + } + } + #ifdef CONFIG_P2P {/* check p2p_ie for assoc req; */ uint p2p_ielen = 0; @@ -9976,7 +9994,9 @@ int rtw_wiphy_register(struct wiphy *wiphy) { RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) +#if ( ((LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) \ + || defined(RTW_VENDOR_EXT_SUPPORT) ) rtw_cfgvendor_attach(wiphy); #endif @@ -9989,7 +10009,9 @@ void rtw_wiphy_unregister(struct wiphy *wiphy) { RTW_INFO(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(RTW_VENDOR_EXT_SUPPORT) +#if ( ((LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) \ + || defined(RTW_VENDOR_EXT_SUPPORT) ) rtw_cfgvendor_detach(wiphy); #endif diff --git a/os_dep/linux/ioctl_cfg80211.h b/os_dep/linux/ioctl_cfg80211.h index b12ce56..6775480 100644 --- a/os_dep/linux/ioctl_cfg80211.h +++ b/os_dep/linux/ioctl_cfg80211.h @@ -407,7 +407,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy); #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)) -u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht); +u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht, bool started); #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 73c4d77..af89009 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1338,15 +1338,13 @@ unsigned int rtw_classify8021d(struct sk_buff *skb) static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) - #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) - , struct net_device *sb_dev - #else + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) + , struct net_device *sb_dev + #else , void *accel_priv - #endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - , select_queue_fallback_t fallback - #endif + #endif + #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0))) + , select_queue_fallback_t fallback #endif #endif ) diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index 212c039..e468574 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -663,12 +663,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -ENOMEM; goto exit; } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)) - if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { -#else + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) { -#endif + #else + if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { + #endif RTW_INFO("%s: failed to access memory\n", __FUNCTION__); ret = -EFAULT; goto exit; diff --git a/os_dep/linux/rtw_cfgvendor.c b/os_dep/linux/rtw_cfgvendor.c index 57fc1a8..d906163 100644 --- a/os_dep/linux/rtw_cfgvendor.c +++ b/os_dep/linux/rtw_cfgvendor.c @@ -1748,9 +1748,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_GET_CAPABILITIES }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_gscan_get_capabilities }, { @@ -1759,9 +1756,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_SET_CONFIG }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_scan_cfg }, { @@ -1770,9 +1764,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_SET_SCAN_CONFIG }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_batch_scan_cfg }, { @@ -1781,9 +1772,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_ENABLE_GSCAN }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_initiate_gscan }, { @@ -1792,9 +1780,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_ENABLE_FULL_SCAN_RESULTS }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_enable_full_scan_result }, { @@ -1803,9 +1788,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_SET_HOTLIST }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_hotlist_cfg }, { @@ -1814,9 +1796,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_SET_SIGNIFICANT_CHANGE_CONFIG }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_significant_change_cfg }, { @@ -1825,9 +1804,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_GET_SCAN_RESULTS }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_gscan_get_batch_results }, { @@ -1836,9 +1812,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = GSCAN_SUBCMD_GET_CHANNEL_LIST }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_gscan_get_channel_list }, #endif /* GSCAN_SUPPORT */ @@ -1849,9 +1822,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = RTT_SUBCMD_SET_CONFIG }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_rtt_set_config }, { @@ -1860,9 +1830,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = RTT_SUBCMD_CANCEL_CONFIG }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_rtt_cancel_config }, { @@ -1871,9 +1838,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = RTT_SUBCMD_GETCAPABILITY }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_rtt_get_capability }, #endif /* RTT_SUPPORT */ @@ -1884,9 +1848,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LSTATS_SUBCMD_GET_INFO }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_lstats_get_info }, { @@ -1895,9 +1856,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LSTATS_SUBCMD_SET_INFO }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_lstats_set_info }, { @@ -1906,9 +1864,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LSTATS_SUBCMD_CLEAR_INFO }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, - #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, - #endif .doit = rtw_cfgvendor_lstats_clear_info }, #endif /* CONFIG_RTW_CFGVEDNOR_LLSTATS */ @@ -1919,9 +1874,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_SET_RSSI_MONITOR }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_rssi_monitor }, #endif /* CONFIG_RTW_CFGVEDNOR_RSSIMONITOR */ @@ -1932,9 +1884,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_START_LOGGING }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_start_logging }, { @@ -1943,9 +1892,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_FEATURE }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_feature }, { @@ -1954,9 +1900,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_VER }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_version }, { @@ -1965,9 +1908,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_RING_STATUS }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_ring_status }, { @@ -1976,9 +1916,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_RING_DATA }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_ring_data }, { @@ -1987,9 +1924,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_TRIGGER_MEM_DUMP }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_firmware_memory_dump }, { @@ -1998,9 +1932,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_START_PKT_FATE_MONITORING }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_start_pkt_fate_monitoring }, { @@ -2009,9 +1940,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_TX_PKT_FATES }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_tx_pkt_fates }, { @@ -2020,9 +1948,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = LOGGER_GET_RX_PKT_FATES }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_logger_get_rx_pkt_fates }, #endif /* CONFIG_RTW_CFGVENDOR_WIFI_LOGGER */ @@ -2034,9 +1959,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_SET_PNO_RANDOM_MAC_OUI }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_rand_mac_oui }, #endif @@ -2046,9 +1968,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_NODFS_SET }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_nodfs_flag }, @@ -2058,9 +1977,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_SET_COUNTRY_CODE }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_country }, { @@ -2069,9 +1985,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_CONFIG_ND_OFFLOAD }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_set_nd_offload }, #endif /* CONFIG_RTW_WIFI_HAL */ @@ -2081,9 +1994,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_GET_FEATURE_SET }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_get_feature_set }, { @@ -2092,9 +2002,6 @@ static const struct wiphy_vendor_command rtw_vendor_cmds[] = { .subcmd = WIFI_SUBCMD_GET_FEATURE_SET_MATRIX }, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0) - .policy = VENDOR_CMD_RAW_DATA, -#endif .doit = rtw_cfgvendor_get_feature_set_matrix } }; diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 66fa74d..041e4dd 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -242,14 +242,6 @@ static struct usb_device_id rtw_usb_id_tbl[] = { {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0xB812, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Default ID for USB Single-function, WiFi only */ /*=== Customer ID ===*/ {USB_DEVICE_AND_INTERFACE_INFO(0x13b1, 0x0043, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Alpha - Alpha*/ - {USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0115, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T4U V3 */ - {USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x012D, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* TP-Link Archer T3U */ - {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xB822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822ULC */ - {USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xC822, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Edimax EW-7822UTC */ - {USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x1841, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* ASUS AC1300 USB-AC55 B1 */ - {USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x184C, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* ASUS U2*/ - {USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x331c, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* Dlink - DWA-182*/ - {USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9055, 0xff, 0xff, 0xff), .driver_info = RTL8822B}, /* NetGear A6150 */ #endif /* CONFIG_RTL8822B */ #ifdef CONFIG_RTL8723D diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index c549e64..35013ed 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2202,9 +2202,9 @@ static int isFileReadable(const char *path, u32 *sz) else { oldfs = get_fs(); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) - set_fs(KERNEL_DS); + set_fs(KERNEL_DS); #else - set_fs(get_ds()); + set_fs(get_ds()); #endif if (1 != readFile(fp, &buf, 1)) @@ -2244,9 +2244,9 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz) oldfs = get_fs(); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) - set_fs(KERNEL_DS); + set_fs(KERNEL_DS); #else - set_fs(get_ds()); + set_fs(get_ds()); #endif ret = readFile(fp, buf, sz); set_fs(oldfs); @@ -2283,9 +2283,9 @@ static int storeToFile(const char *path, u8 *buf, u32 sz) oldfs = get_fs(); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)) - set_fs(KERNEL_DS); + set_fs(KERNEL_DS); #else - set_fs(get_ds()); + set_fs(get_ds()); #endif ret = writeFile(fp, buf, sz); set_fs(oldfs);