FAILED: patch "[PATCH] staging: rtl8723bs: fix WEP length underflow and OOB read in" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x a1fc19d61f661d47204f095b593de507884849f7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071352-wreckage-humorless-3481@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a1fc19d61f661d47204f095b593de507884849f7 Mon Sep 17 00:00:00 2001
From: Alexandru Hossu <[email protected]>
Date: Fri, 22 May 2026 02:46:05 +0200
Subject: [PATCH] staging: rtl8723bs: fix WEP length underflow and OOB read in
OnAuth()
OnAuth() has two bugs in the shared-key authentication path.
When the Privacy bit is set, rtw_wep_decrypt() is called without verifying that the frame is long enough to contain a valid WEP IV and ICV. Inside rtw_wep_decrypt(), length is computed as:
length = len - WLAN_HDR_A3_LEN - iv_len
and then passed as (length - 4) to crc32_le(). If len is less than WLAN_HDR_A3_LEN + iv_len + icv_len (32 bytes), length - 4 is negative and, after the implicit cast to size_t, causes crc32_le() to read far beyond the frame buffer. Add a minimum length check before accessing the IV field and calling the decryption path.
When processing a seq=3 response, rtw_get_ie() stores the Challenge Text IE length in ie_len, but the subsequent memcmp() always reads 128 bytes regardless of ie_len. IEEE 802.11 mandates a challenge text of exactly 128 bytes; reject any IE whose length field differs, matching the check already applied to OnAuthClient().
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +7 -1
@@ -677,6 +677,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)if ((pmlmeinfo->state&0x03 ) !=WIFI_FW_AP_STATE )return _FAIL; +if (len <WLAN_HDR_A3_LEN ) +return _FAIL; + sa =GetAddr2Ptr (pframe); auth_mode = psecuritypriv->dot11AuthAlgrthm;
@@ -688,6 +691,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) prxattrib->hdrlen =WLAN_HDR_A3_LEN ; prxattrib->encrypt = _WEP40_; +if (len <WLAN_HDR_A3_LEN +8 ) +return _FAIL; + iv = pframe+prxattrib->hdrlen; prxattrib->key_index = ((iv[3 ]>>6 )&0x3 );
@@ -787,7 +793,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) p =rtw_get_ie (pframe +WLAN_HDR_A3_LEN +4 + _AUTH_IE_OFFSET_,WLAN_EID_CHALLENGE , (int *)&ie_len, len -WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ -4 ); -if (!p || ie_len <=0 ) { +if (!p || ie_len !=128 ) { status =WLAN_STATUS_CHALLENGE_FAIL ; goto auth_fail; }
Sasha Levin
maintainerPATCH 1/8 staging: rtl8723bs: split too long line
From: Fabio Aiuto <[email protected]>
[ Upstream commit 98dc120895a9a669e35155ee03b98452723aba95 ]
fix the following post-commit hook checkpatch issue.
WARNING: line length of 103 exceeds 100 columns
30: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:711:
+receive_disconnect(padapter, pmlmeinfo->network.MacAddress, 0);
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -1
@@ -835,7 +835,8 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame) ret =rtw_check_bcn_info (padapter, pframe, len);if (!ret) {DBG_871X_LEVEL (_drv_always_,"ap has changed, disconnect now\n " ); -receive_disconnect (padapter, pmlmeinfo->network.MacAddress,0 ); +receive_disconnect (padapter, + pmlmeinfo->network.MacAddress,0 );return _SUCCESS; }/* update WMM, ERP in the beacon */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/8 staging: rtl8723bs: remove commented out RT_ASSERT occurrences
From: Fabio Aiuto <[email protected]>
[ Upstream commit 2172a6576388e63958f47923e435c46af8d006ba ]
remove commented out obsoete RT_ASSERT macro occurences.
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 2 -- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 1 - drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- 3 files changed, 8 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +0 -2
@@ -2165,8 +2165,6 @@ int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reorder_ctr/* pTS->RxIndicateState = RXTS_INDICATE_PROCESSING; */ /* Indicate packets */ -/* RT_ASSERT((index<=REORDER_WIN_SIZE), ("RxReorderIndicatePacket(): Rx Reorder buffer full!!\n")); */ -/* indicate this recv_frame */ /* DbgPrint("recv_indicatepkts_in_order, indicate_seq =%d, seq_num =%d\n", precvpriv->indicate_seq, pattrib->seq_num); */
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -1
@@ -158,7 +158,6 @@ static int _WriteFW(struct adapter *padapter, void *buffer, u32 size)u8 *bufferPtr = buffer; pageNums = size /MAX_DLFW_PAGE_SIZE ; -/* RT_ASSERT((pageNums <= 4), ("Page numbers should not greater then 4\n")); */ remainSize = size %MAX_DLFW_PAGE_SIZE ;for (page =0 ; page < pageNums; page++) {
drivers/staging/rtl8723bs/hal/sdio_halinit.c +0 -5
@@ -313,7 +313,6 @@ static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter) value =QUEUE_NORMAL ;break ;default : -/* RT_ASSERT(false, ("Shall not reach here!\n")); */ break ; }
@@ -347,7 +346,6 @@ static void _InitNormalChipTwoOutEpPriority(struct adapter *Adapter) valueLow =QUEUE_NORMAL ;break ;default : -/* RT_ASSERT(false, ("Shall not reach here!\n")); */ break ; }
@@ -412,7 +410,6 @@ static void _InitQueuePriority(struct adapter *Adapter)_InitNormalChipThreeOutEpPriority (Adapter);break ;default : -/* RT_ASSERT(false, ("Shall not reach here!\n")); */ break ; }
@@ -603,7 +600,6 @@ static void _InitOperationMode(struct adapter *padapter) regBwOpMode =BW_OPMODE_20MHZ ;break ;case WIRELESS_MODE_A : -/* RT_ASSERT(false, ("Error wireless a mode\n")); */ break ;case WIRELESS_MODE_G : regBwOpMode =BW_OPMODE_20MHZ ;
@@ -617,7 +613,6 @@ static void _InitOperationMode(struct adapter *padapter) regBwOpMode =BW_OPMODE_20MHZ ;break ;case WIRELESS_MODE_N_5G : -/* RT_ASSERT(false, ("Error wireless mode")); */ regBwOpMode =BW_OPMODE_5G ;break ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/8 staging: rtl8723bs: remove all 5Ghz network types
In reply to Sasha LevinFrom: Fabio Aiuto <[email protected]>
[ Upstream commit 708180a92cd8bff18b3d2ac05172815bcc0b6b9a ]
remove all 5Ghz network types. rtl8723bs works on
802.11bgn standards and on 2.4Ghz band.
So remove all code related to 802.11a and 802.11ac standards, which the device doesn't support.
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_ap.c | 11 +--- .../staging/rtl8723bs/core/rtw_ieee80211.c | 22 ++------ drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 ---- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 55 ------------------- .../staging/rtl8723bs/core/rtw_wlan_util.c | 14 +---- drivers/staging/rtl8723bs/hal/odm.c | 30 ---------- drivers/staging/rtl8723bs/hal/odm.h | 3 - .../rtl8723bs/hal/odm_EdcaTurboCheck.c | 4 +- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 -- drivers/staging/rtl8723bs/include/hal_phy.h | 3 - drivers/staging/rtl8723bs/include/ieee80211.h | 22 +------- drivers/staging/rtl8723bs/include/wifi.h | 1 - drivers/staging/rtl8723bs/os_dep/os_intfs.c | 2 +- 13 files changed, 14 insertions(+), 168 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -9
@@ -427,11 +427,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) shortGIrate =query_ra_short_GI (psta);if (pcur_network->Configuration.DSConfig >14 ) { -if (tx_ra_bitmap &0xffff000 ) - sta_band |=WIRELESS_11_5N ; - -if (tx_ra_bitmap &0xff0 ) - sta_band |=WIRELESS_11A ; + sta_band |=WIRELESS_INVALID ; }else {if (tx_ra_bitmap &0xffff000 ) sta_band |=WIRELESS_11_24N ;
@@ -503,7 +499,7 @@ void update_bmc_sta(struct adapter *padapter) }else if (network_type ==WIRELESS_INVALID ) {/* error handling */ if (pcur_network->Configuration.DSConfig >14 ) - network_type =WIRELESS_11A ; + network_type =WIRELESS_INVALID ;else network_type =WIRELESS_11B ; }
@@ -1254,9 +1250,6 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)case WIRELESS_11BG_24N : pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;break ; -case WIRELESS_11A : - pbss_network->NetworkTypeInUse = Ndis802_11OFDM5; -break ;default : pbss_network->NetworkTypeInUse = Ndis802_11OFDM24;break ;
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +4 -18
@@ -96,10 +96,7 @@ bool rtw_is_cckratesonly_included(u8 *rate)int rtw_check_network_type (unsigned char *rate,int ratelen,int channel) {if (channel >14 ) { -if (rtw_is_cckrates_included (rate)) -return WIRELESS_INVALID ; -else -return WIRELESS_11A ; +return WIRELESS_INVALID ; }else {/* could be pure B, pure G, or B/G */ if (rtw_is_cckratesonly_included (rate))return WIRELESS_11B ;
@@ -275,10 +272,6 @@ void rtw_set_supported_rate(u8 *SupportedRates, uint mode)break ;case WIRELESS_11G : -case WIRELESS_11A : -case WIRELESS_11_5N : -case WIRELESS_11A_5N :/* Todo: no basic rate for ofdm ? */ -case WIRELESS_11_5AC :memcpy (SupportedRates,WIFI_OFDMRATES ,IEEE80211_NUM_OFDM_RATESLEN );break ;
@@ -336,14 +329,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) ie =rtw_set_ie (ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz);/* supported rates */ -if (pregistrypriv->wireless_mode ==WIRELESS_11ABGN ) { -if (pdev_network->Configuration.DSConfig >14 ) - wireless_mode =WIRELESS_11A_5N ; -else - wireless_mode =WIRELESS_11BG_24N ; - }else { - wireless_mode = pregistrypriv->wireless_mode; - } + wireless_mode = pregistrypriv->wireless_mode;rtw_set_supported_rate (pdev_network->SupportedRates, wireless_mode);
@@ -368,8 +354,8 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) }/* HT Cap. */ -if (((pregistrypriv->wireless_mode&WIRELESS_11_5N ) || (pregistrypriv->wireless_mode&WIRELESS_11_24N )) - && (pregistrypriv->ht_enable == true)) { +if ((pregistrypriv->wireless_mode &WIRELESS_11_24N ) && + (pregistrypriv->ht_enable == true)) {/* todo: */ }
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -10
@@ -2438,16 +2438,6 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter)case WIRELESS_11BG_24N : pdev_network->NetworkTypeInUse = (Ndis802_11OFDM24);break ; -case WIRELESS_11A : -case WIRELESS_11A_5N : - pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5); -break ; -case WIRELESS_11ABGN : -if (pregistrypriv->channel >14 ) - pdev_network->NetworkTypeInUse = (Ndis802_11OFDM5); -else - pdev_network->NetworkTypeInUse = (Ndis802_11OFDM24); -break ;default :/* TODO */ break ;
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +0 -55
61 lines not on this page · raw message
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +3 -11
@@ -62,9 +62,6 @@ u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta)if (cur_rf_type ==RF_1T1R ) { rf_type =RF_1T1R ; - }else if (IsSupportedVHT (psta->wireless_mode)) { -if (psta->ra_mask &0xffc00000 ) - rf_type =RF_2T2R ; }else if (IsSupportedHT (psta->wireless_mode)) {if (psta->ra_mask &0xfff00000 ) rf_type =RF_2T2R ;
@@ -74,7 +71,6 @@ u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta)case WIRELESS_11B : raid =RATEID_IDX_B ;break ; -case WIRELESS_11A :case WIRELESS_11G : raid =RATEID_IDX_G ;break ;
@@ -82,8 +78,6 @@ u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta) raid =RATEID_IDX_BG ;break ;case WIRELESS_11_24N : -case WIRELESS_11_5N : -case WIRELESS_11A_5N :case WIRELESS_11G_24N :if (rf_type ==RF_2T2R ) raid =RATEID_IDX_GN_N2SS ;
@@ -810,7 +804,7 @@ void WMMOnAssocRsp(struct adapter *padapter)AIFS = aSifsTime + (2 * pmlmeinfo->slotTime); -if (pmlmeext->cur_wireless_mode & (WIRELESS_11G |WIRELESS_11A )) { +if (pmlmeext->cur_wireless_mode &WIRELESS_11G ) { ECWMin =4 ; ECWMax =10 ; }else if (pmlmeext->cur_wireless_mode &WIRELESS_11B ) {
@@ -1695,7 +1689,7 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap) pmlmeinfo->slotTime =NON_SHORT_SLOT_TIME ; else {/* Filen: See 802.11-2007 p.90 */ -if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N |WIRELESS_11A |WIRELESS_11_5N |WIRELESS_11AC )) +if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N )) pmlmeinfo->slotTime =SHORT_SLOT_TIME ;else if (pmlmeext->cur_wireless_mode & (WIRELESS_11G )) {if ((updateCap & cShortSlotTime)/* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */ )
@@ -1724,9 +1718,7 @@ void update_wireless_mode(struct adapter *padapter)if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) pmlmeinfo->HT_enable =1 ; -if (pmlmeinfo->VHT_enable) - network_type =WIRELESS_11AC ; -else if (pmlmeinfo->HT_enable) +if (pmlmeinfo->HT_enable) network_type =WIRELESS_11_24N ;if (rtw_is_cckratesonly_included (rate))
drivers/staging/rtl8723bs/hal/odm.c +0 -30
@@ -975,7 +975,6 @@ u32 ODM_Get_Rate_Bitmap(break ;case (ODM_WM_G ): -case (ODM_WM_A ):if (rssi_level ==DM_RATR_STA_HIGH ) rate_bitmap =0x00000f00 ;else
@@ -994,7 +993,6 @@ u32 ODM_Get_Rate_Bitmap(case (ODM_WM_B |ODM_WM_G |ODM_WM_N24G ):case (ODM_WM_B |ODM_WM_N24G ):case (ODM_WM_G |ODM_WM_N24G ): -case (ODM_WM_A |ODM_WM_N5G ):if (pDM_Odm->RFType ==ODM_1T2R || pDM_Odm->RFType ==ODM_1T1R ) {if (rssi_level ==DM_RATR_STA_HIGH ) rate_bitmap =0x000f0000 ;
@@ -1020,34 +1018,6 @@ u32 ODM_Get_Rate_Bitmap( }break ; -case (ODM_WM_AC |ODM_WM_G ): -if (rssi_level ==1 ) - rate_bitmap =0xfc3f0000 ; -else if (rssi_level ==2 ) - rate_bitmap =0xfffff000 ; -else - rate_bitmap =0xffffffff ; -break ; - -case (ODM_WM_AC |ODM_WM_A ): - -if (pDM_Odm->RFType ==RF_1T1R ) { -if (rssi_level ==1 )/* add by Gary for ac-series */ - rate_bitmap =0x003f8000 ; -else if (rssi_level ==2 ) - rate_bitmap =0x003ff000 ; -else - rate_bitmap =0x003ff010 ; - }else { -if (rssi_level ==1 )/* add by Gary for ac-series */ - rate_bitmap =0xfe3f8000 ;/* VHT 2SS MCS3~9 */ -else if (rssi_level ==2 ) - rate_bitmap =0xfffff000 ;/* VHT 2SS MCS0~9 */ -else - rate_bitmap =0xfffff010 ;/* All */ - } -break ; -default :if (pDM_Odm->RFType ==RF_1T2R ) rate_bitmap =0x000fffff ;
drivers/staging/rtl8723bs/hal/odm.h +0 -3
@@ -541,11 +541,8 @@ typedef enum tag_Wireless_Mode_Definition {ODM_WM_UNKNOWN =0x0 ,ODM_WM_B =BIT0 ,ODM_WM_G =BIT1 , -ODM_WM_A =BIT2 ,ODM_WM_N24G =BIT3 , -ODM_WM_N5G =BIT4 ,ODM_WM_AUTO =BIT5 , -ODM_WM_AC =BIT6 , } ODM_WIRELESS_MODE_E;/* ODM_CMNINFO_BAND */
drivers/staging/rtl8723bs/hal/odm_EdcaTurboCheck.c +1 -3
@@ -142,12 +142,10 @@ void odm_EdcaTurboCheckCE(void *pDM_VOID) }else if ((iot_peer ==HT_IOT_PEER_CISCO ) && ((wirelessmode ==ODM_WM_G ) || (wirelessmode == (ODM_WM_B |ODM_WM_G )) || - (wirelessmode ==ODM_WM_A ) || (wirelessmode ==ODM_WM_B ))) {EDCA_BE_DL = edca_setting_DL_GMode[iot_peer]; }else if ((iot_peer ==HT_IOT_PEER_AIRGO ) && - ((wirelessmode ==ODM_WM_G ) || - (wirelessmode ==ODM_WM_A ))) { + (wirelessmode ==ODM_WM_G )) {EDCA_BE_DL =0xa630 ; }else if (iot_peer ==HT_IOT_PEER_MARVELL ) {EDCA_BE_DL = edca_setting_DL[iot_peer];
drivers/staging/rtl8723bs/hal/sdio_halinit.c +0 -5
@@ -599,8 +599,6 @@ static void _InitOperationMode(struct adapter *padapter)case WIRELESS_MODE_B : regBwOpMode =BW_OPMODE_20MHZ ;break ; -case WIRELESS_MODE_A : -break ;case WIRELESS_MODE_G : regBwOpMode =BW_OPMODE_20MHZ ;break ;
@@ -612,9 +610,6 @@ static void _InitOperationMode(struct adapter *padapter)/* CCK rate will be filtered out only when associated AP does not support it. */ regBwOpMode =BW_OPMODE_20MHZ ;break ; -case WIRELESS_MODE_N_5G : - regBwOpMode =BW_OPMODE_5G ; -break ;default :/* for MacOSX compiler warning. */ break ;
drivers/staging/rtl8723bs/include/hal_phy.h +0 -3
@@ -118,13 +118,10 @@ enum HW_BLOCK {enum WIRELESS_MODE {WIRELESS_MODE_UNKNOWN =0x00 , -WIRELESS_MODE_A =0x01 ,WIRELESS_MODE_B =0x02 ,WIRELESS_MODE_G =0x04 ,WIRELESS_MODE_AUTO =0x08 ,WIRELESS_MODE_N_24G =0x10 , -WIRELESS_MODE_N_5G =0x20 , -WIRELESS_MODE_AC_5G =0x40 ,WIRELESS_MODE_AC_24G =0x80 ,WIRELESS_MODE_AC_ONLY =0x100 , };
drivers/staging/rtl8723bs/include/ieee80211.h +3 -19
@@ -157,33 +157,20 @@ enum NETWORK_TYPE {/* Sub-Element */ WIRELESS_11B =BIT (0 ),/* tx: cck only , rx: cck only, hw: cck */ WIRELESS_11G =BIT (1 ),/* tx: ofdm only, rx: ofdm & cck, hw: cck & ofdm */ -WIRELESS_11A =BIT (2 ),/* tx: ofdm only, rx: ofdm only, hw: ofdm only */ WIRELESS_11_24N =BIT (3 ),/* tx: MCS only, rx: MCS & cck, hw: MCS & cck */ -WIRELESS_11_5N =BIT (4 ),/* tx: MCS only, rx: MCS & ofdm, hw: ofdm only */ WIRELESS_AUTO =BIT (5 ), -WIRELESS_11AC =BIT (6 ),/* Combination */ /* Type for current wireless mode */ WIRELESS_11BG = (WIRELESS_11B |WIRELESS_11G ),/* tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm */ WIRELESS_11G_24N = (WIRELESS_11G |WIRELESS_11_24N ),/* tx: ofdm & MCS, rx: ofdm & cck & MCS, hw: cck & ofdm */ -WIRELESS_11A_5N = (WIRELESS_11A |WIRELESS_11_5N ),/* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */ WIRELESS_11B_24N = (WIRELESS_11B |WIRELESS_11_24N ),/* tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck */ WIRELESS_11BG_24N = (WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N), /* tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck */ -WIRELESS_11_24AC = (WIRELESS_11G |WIRELESS_11AC ), -WIRELESS_11_5AC = (WIRELESS_11A |WIRELESS_11AC ), - - -/* Type for registry default wireless mode */ -WIRELESS_11AGN = (WIRELESS_11A |WIRELESS_11G |WIRELESS_11_24N |WIRELESS_11_5N ),/* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */ -WIRELESS_11ABGN = (WIRELESS_11A |WIRELESS_11B |WIRELESS_11G |WIRELESS_11_24N |WIRELESS_11_5N ), -WIRELESS_MODE_24G = (WIRELESS_11B |WIRELESS_11G |WIRELESS_11_24N |WIRELESS_11AC ), - WIRELESS_MODE_MAX = (WIRELESS_11A|WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N|WIRELESS_11AC), };#define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N) -#define IsLegacyOnly (NetType) ((NetType) == ((NetType) & (WIRELESS_11BG|WIRELESS_11A))) +#define IsLegacyOnly (NetType) ((NetType) == ((NetType) & (WIRELESS_11BG)))#define IsSupported24G (NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
@@ -195,11 +182,8 @@ enum NETWORK_TYPE {#define IsSupportedRxHT (NetType) IsEnableHWOFDM(NetType)#define IsSupportedTxCCK (NetType) (((NetType) & (WIRELESS_11B)) ? true : false) -#define IsSupportedTxOFDM (NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11A)) ? true : false) -#define IsSupportedHT (NetType) (((NetType) & (WIRELESS_11_24N|WIRELESS_11_5N)) ? true : false) - -#define IsSupportedVHT (NetType) (((NetType) & (WIRELESS_11AC)) ? true : false) - +#define IsSupportedTxOFDM (NetType) (((NetType) & (WIRELESS_11G) ? true : false) +#define IsSupportedHT (NetType) (((NetType) & (WIRELESS_11_24N)) ? true : false)struct ieee_param {u32 cmd;
drivers/staging/rtl8723bs/include/wifi.h +0 -1
@@ -457,7 +457,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)#define _PRE_ALLOCICVHDR_ 5#define _PRE_ALLOCMICHDR_ 6 -#define _SIFSTIME_ ((priv->pmib->dot11BssType.net_work_type&WIRELESS_11A)?16:10)#define _ACKCTSLNG_ 14/* 14 bytes long, including crclng */ #define _CRCLNG_ 4
drivers/staging/rtl8723bs/os_dep/os_intfs.c +1 -1
@@ -24,7 +24,7 @@ static int rtw_lbkmode;/* RTL8712_AIR_TRX; */static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure;infra, ad-hoc, auto */ /* struct ndis_802_11_ssid ssid; */ static int rtw_channel =1 ;/* ad-hoc support requirement */ -static int rtw_wireless_mode =WIRELESS_MODE_MAX ; +static int rtw_wireless_mode =WIRELESS_11BG_24N ;static int rtw_vrtl_carrier_sense =AUTO_VCS ;static int rtw_vcs_type =RTS_CTS ;/* */ static int rtw_rts_thresh =2347 ;/* */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/8 staging: rtl8723bs: remove 5Ghz code related to channel plan definition
In reply to Sasha LevinFrom: Fabio Aiuto <[email protected]>
[ Upstream commit ec84d0ae54a6774091b3b7d1e9da32589f48b2f9 ]
remove 5Ghz code related to channel plan definition.
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 210 ++++++++---------- .../staging/rtl8723bs/hal/hal_com_phycfg.c | 34 --- .../staging/rtl8723bs/include/rtw_mlme_ext.h | 6 +- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 1 - 5 files changed, 94 insertions(+), 159 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +92 -118
@@ -123,93 +123,93 @@ static RT_CHANNEL_PLAN_5G RTW_ChannelPlan5G[RT_CHANNEL_DOMAIN_5G_MAX] = {static RT_CHANNEL_PLAN_MAP RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX ] = {/* 0x00 ~ 0x1F , Old Define ===== */ - {0x02 ,0x20 },/* 0x00, RT_CHANNEL_DOMAIN_FCC */ - {0x02 ,0x0A },/* 0x01, RT_CHANNEL_DOMAIN_IC */ - {0x01 ,0x01 },/* 0x02, RT_CHANNEL_DOMAIN_ETSI */ - {0x01 ,0x00 },/* 0x03, RT_CHANNEL_DOMAIN_SPAIN */ - {0x01 ,0x00 },/* 0x04, RT_CHANNEL_DOMAIN_FRANCE */ - {0x03 ,0x00 },/* 0x05, RT_CHANNEL_DOMAIN_MKK */ - {0x03 ,0x00 },/* 0x06, RT_CHANNEL_DOMAIN_MKK1 */ - {0x01 ,0x09 },/* 0x07, RT_CHANNEL_DOMAIN_ISRAEL */ - {0x03 ,0x09 },/* 0x08, RT_CHANNEL_DOMAIN_TELEC */ - {0x03 ,0x00 },/* 0x09, RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN */ - {0x00 ,0x00 },/* 0x0A, RT_CHANNEL_DOMAIN_WORLD_WIDE_13 */ - {0x02 ,0x0F },/* 0x0B, RT_CHANNEL_DOMAIN_TAIWAN */ - {0x01 ,0x08 },/* 0x0C, RT_CHANNEL_DOMAIN_CHINA */ - {0x02 ,0x06 },/* 0x0D, RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO */ - {0x02 ,0x0B },/* 0x0E, RT_CHANNEL_DOMAIN_KOREA */ - {0x02 ,0x09 },/* 0x0F, RT_CHANNEL_DOMAIN_TURKEY */ - {0x01 ,0x01 },/* 0x10, RT_CHANNEL_DOMAIN_JAPAN */ - {0x02 ,0x05 },/* 0x11, RT_CHANNEL_DOMAIN_FCC_NO_DFS */ - {0x01 ,0x21 },/* 0x12, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS */ - {0x00 ,0x04 },/* 0x13, RT_CHANNEL_DOMAIN_WORLD_WIDE_5G */ - {0x02 ,0x10 },/* 0x14, RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS */ - {0x00 ,0x21 },/* 0x15, RT_CHANNEL_DOMAIN_ETSI_NO_DFS */ - {0x00 ,0x22 },/* 0x16, RT_CHANNEL_DOMAIN_KOREA_NO_DFS */ - {0x03 ,0x21 },/* 0x17, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS */ - {0x06 ,0x08 },/* 0x18, RT_CHANNEL_DOMAIN_PAKISTAN_NO_DFS */ - {0x02 ,0x08 },/* 0x19, RT_CHANNEL_DOMAIN_TAIWAN2_NO_DFS */ - {0x00 ,0x00 },/* 0x1A, */ - {0x00 ,0x00 },/* 0x1B, */ - {0x00 ,0x00 },/* 0x1C, */ - {0x00 ,0x00 },/* 0x1D, */ - {0x00 ,0x00 },/* 0x1E, */ - {0x06 ,0x04 },/* 0x1F, RT_CHANNEL_DOMAIN_WORLD_WIDE_ONLY_5G */ + {0x02 },/* 0x00, RT_CHANNEL_DOMAIN_FCC */ + {0x02 },/* 0x01, RT_CHANNEL_DOMAIN_IC */ + {0x01 },/* 0x02, RT_CHANNEL_DOMAIN_ETSI */ + {0x01 },/* 0x03, RT_CHANNEL_DOMAIN_SPAIN */ + {0x01 },/* 0x04, RT_CHANNEL_DOMAIN_FRANCE */ + {0x03 },/* 0x05, RT_CHANNEL_DOMAIN_MKK */ + {0x03 },/* 0x06, RT_CHANNEL_DOMAIN_MKK1 */ + {0x01 },/* 0x07, RT_CHANNEL_DOMAIN_ISRAEL */ + {0x03 },/* 0x08, RT_CHANNEL_DOMAIN_TELEC */ + {0x03 },/* 0x09, RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN */ + {0x00 },/* 0x0A, RT_CHANNEL_DOMAIN_WORLD_WIDE_13 */ + {0x02 },/* 0x0B, RT_CHANNEL_DOMAIN_TAIWAN */ + {0x01 },/* 0x0C, RT_CHANNEL_DOMAIN_CHINA */ + {0x02 },/* 0x0D, RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO */ + {0x02 },/* 0x0E, RT_CHANNEL_DOMAIN_KOREA */ + {0x02 },/* 0x0F, RT_CHANNEL_DOMAIN_TURKEY */ + {0x01 },/* 0x10, RT_CHANNEL_DOMAIN_JAPAN */ + {0x02 },/* 0x11, RT_CHANNEL_DOMAIN_FCC_NO_DFS */ + {0x01 },/* 0x12, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS */ + {0x00 },/* 0x13, RT_CHANNEL_DOMAIN_WORLD_WIDE_5G */ + {0x02 },/* 0x14, RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS */ + {0x00 },/* 0x15, RT_CHANNEL_DOMAIN_ETSI_NO_DFS */ + {0x00 },/* 0x16, RT_CHANNEL_DOMAIN_KOREA_NO_DFS */ + {0x03 },/* 0x17, RT_CHANNEL_DOMAIN_JAPAN_NO_DFS */ + {0x06 },/* 0x18, RT_CHANNEL_DOMAIN_PAKISTAN_NO_DFS */ + {0x02 },/* 0x19, RT_CHANNEL_DOMAIN_TAIWAN2_NO_DFS */ + {0x00 },/* 0x1A, */ + {0x00 },/* 0x1B, */ + {0x00 },/* 0x1C, */ + {0x00 },/* 0x1D, */ + {0x00 },/* 0x1E, */ + {0x06 },/* 0x1F, RT_CHANNEL_DOMAIN_WORLD_WIDE_ONLY_5G */ /* 0x20 ~ 0x7F , New Define ===== */ - {0x00 ,0x00 },/* 0x20, RT_CHANNEL_DOMAIN_WORLD_NULL */ - {0x01 ,0x00 },/* 0x21, RT_CHANNEL_DOMAIN_ETSI1_NULL */ - {0x02 ,0x00 },/* 0x22, RT_CHANNEL_DOMAIN_FCC1_NULL */ - {0x03 ,0x00 },/* 0x23, RT_CHANNEL_DOMAIN_MKK1_NULL */ - {0x04 ,0x00 },/* 0x24, RT_CHANNEL_DOMAIN_ETSI2_NULL */ - {0x02 ,0x04 },/* 0x25, RT_CHANNEL_DOMAIN_FCC1_FCC1 */ - {0x00 ,0x01 },/* 0x26, RT_CHANNEL_DOMAIN_WORLD_ETSI1 */ - {0x03 ,0x0C },/* 0x27, RT_CHANNEL_DOMAIN_MKK1_MKK1 */ - {0x00 ,0x0B },/* 0x28, RT_CHANNEL_DOMAIN_WORLD_KCC1 */ - {0x00 ,0x05 },/* 0x29, RT_CHANNEL_DOMAIN_WORLD_FCC2 */ - {0x00 ,0x00 },/* 0x2A, */ - {0x00 ,0x00 },/* 0x2B, */ - {0x00 ,0x00 },/* 0x2C, */ - {0x00 ,0x00 },/* 0x2D, */ - {0x00 ,0x00 },/* 0x2E, */ - {0x00 ,0x00 },/* 0x2F, */ - {0x00 ,0x06 },/* 0x30, RT_CHANNEL_DOMAIN_WORLD_FCC3 */ - {0x00 ,0x07 },/* 0x31, RT_CHANNEL_DOMAIN_WORLD_FCC4 */ - {0x00 ,0x08 },/* 0x32, RT_CHANNEL_DOMAIN_WORLD_FCC5 */ - {0x00 ,0x09 },/* 0x33, RT_CHANNEL_DOMAIN_WORLD_FCC6 */ - {0x02 ,0x0A },/* 0x34, RT_CHANNEL_DOMAIN_FCC1_FCC7 */ - {0x00 ,0x02 },/* 0x35, RT_CHANNEL_DOMAIN_WORLD_ETSI2 */ - {0x00 ,0x03 },/* 0x36, RT_CHANNEL_DOMAIN_WORLD_ETSI3 */ - {0x03 ,0x0D },/* 0x37, RT_CHANNEL_DOMAIN_MKK1_MKK2 */ - {0x03 ,0x0E },/* 0x38, RT_CHANNEL_DOMAIN_MKK1_MKK3 */ - {0x02 ,0x0F },/* 0x39, RT_CHANNEL_DOMAIN_FCC1_NCC1 */ - {0x00 ,0x00 },/* 0x3A, */ - {0x00 ,0x00 },/* 0x3B, */ - {0x00 ,0x00 },/* 0x3C, */ - {0x00 ,0x00 },/* 0x3D, */ - {0x00 ,0x00 },/* 0x3E, */ - {0x00 ,0x00 },/* 0x3F, */ - {0x02 ,0x10 },/* 0x40, RT_CHANNEL_DOMAIN_FCC1_NCC2 */ - {0x05 ,0x00 },/* 0x41, RT_CHANNEL_DOMAIN_GLOBAL_NULL */ - {0x01 ,0x12 },/* 0x42, RT_CHANNEL_DOMAIN_ETSI1_ETSI4 */ - {0x02 ,0x05 },/* 0x43, RT_CHANNEL_DOMAIN_FCC1_FCC2 */ - {0x02 ,0x11 },/* 0x44, RT_CHANNEL_DOMAIN_FCC1_NCC3 */ - {0x00 ,0x13 },/* 0x45, RT_CHANNEL_DOMAIN_WORLD_ETSI5 */ - {0x02 ,0x14 },/* 0x46, RT_CHANNEL_DOMAIN_FCC1_FCC8 */ - {0x00 ,0x15 },/* 0x47, RT_CHANNEL_DOMAIN_WORLD_ETSI6 */ - {0x00 ,0x16 },/* 0x48, RT_CHANNEL_DOMAIN_WORLD_ETSI7 */ - {0x00 ,0x17 },/* 0x49, RT_CHANNEL_DOMAIN_WORLD_ETSI8 */ - {0x00 ,0x18 },/* 0x50, RT_CHANNEL_DOMAIN_WORLD_ETSI9 */ - {0x00 ,0x19 },/* 0x51, RT_CHANNEL_DOMAIN_WORLD_ETSI10 */ - {0x00 ,0x1A },/* 0x52, RT_CHANNEL_DOMAIN_WORLD_ETSI11 */ - {0x02 ,0x1B },/* 0x53, RT_CHANNEL_DOMAIN_FCC1_NCC4 */ - {0x00 ,0x1C },/* 0x54, RT_CHANNEL_DOMAIN_WORLD_ETSI12 */ - {0x02 ,0x1D },/* 0x55, RT_CHANNEL_DOMAIN_FCC1_FCC9 */ - {0x00 ,0x1E },/* 0x56, RT_CHANNEL_DOMAIN_WORLD_ETSI13 */ - {0x02 ,0x1F },/* 0x57, RT_CHANNEL_DOMAIN_FCC1_FCC10 */ + {0x00 },/* 0x20, RT_CHANNEL_DOMAIN_WORLD_NULL */ + {0x01 },/* 0x21, RT_CHANNEL_DOMAIN_ETSI1_NULL */ + {0x02 },/* 0x22, RT_CHANNEL_DOMAIN_FCC1_NULL */ + {0x03 },/* 0x23, RT_CHANNEL_DOMAIN_MKK1_NULL */ + {0x04 },/* 0x24, RT_CHANNEL_DOMAIN_ETSI2_NULL */ + {0x02 },/* 0x25, RT_CHANNEL_DOMAIN_FCC1_FCC1 */ + {0x00 },/* 0x26, RT_CHANNEL_DOMAIN_WORLD_ETSI1 */ + {0x03 },/* 0x27, RT_CHANNEL_DOMAIN_MKK1_MKK1 */ + {0x00 },/* 0x28, RT_CHANNEL_DOMAIN_WORLD_KCC1 */ + {0x00 },/* 0x29, RT_CHANNEL_DOMAIN_WORLD_FCC2 */ + {0x00 },/* 0x2A, */ + {0x00 },/* 0x2B, */ + {0x00 },/* 0x2C, */ + {0x00 },/* 0x2D, */ + {0x00 },/* 0x2E, */ + {0x00 },/* 0x2F, */ + {0x00 },/* 0x30, RT_CHANNEL_DOMAIN_WORLD_FCC3 */ + {0x00 },/* 0x31, RT_CHANNEL_DOMAIN_WORLD_FCC4 */ + {0x00 },/* 0x32, RT_CHANNEL_DOMAIN_WORLD_FCC5 */ + {0x00 },/* 0x33, RT_CHANNEL_DOMAIN_WORLD_FCC6 */ + {0x02 },/* 0x34, RT_CHANNEL_DOMAIN_FCC1_FCC7 */ + {0x00 },/* 0x35, RT_CHANNEL_DOMAIN_WORLD_ETSI2 */ + {0x00 },/* 0x36, RT_CHANNEL_DOMAIN_WORLD_ETSI3 */ + {0x03 },/* 0x37, RT_CHANNEL_DOMAIN_MKK1_MKK2 */ + {0x03 },/* 0x38, RT_CHANNEL_DOMAIN_MKK1_MKK3 */ + {0x02 },/* 0x39, RT_CHANNEL_DOMAIN_FCC1_NCC1 */ + {0x00 },/* 0x3A, */ + {0x00 },/* 0x3B, */ + {0x00 },/* 0x3C, */ + {0x00 },/* 0x3D, */ + {0x00 },/* 0x3E, */ + {0x00 },/* 0x3F, */ + {0x02 },/* 0x40, RT_CHANNEL_DOMAIN_FCC1_NCC2 */ + {0x05 },/* 0x41, RT_CHANNEL_DOMAIN_GLOBAL_NULL */ + {0x01 },/* 0x42, RT_CHANNEL_DOMAIN_ETSI1_ETSI4 */ + {0x02 },/* 0x43, RT_CHANNEL_DOMAIN_FCC1_FCC2 */ + {0x02 },/* 0x44, RT_CHANNEL_DOMAIN_FCC1_NCC3 */ + {0x00 },/* 0x45, RT_CHANNEL_DOMAIN_WORLD_ETSI5 */ + {0x02 },/* 0x46, RT_CHANNEL_DOMAIN_FCC1_FCC8 */ + {0x00 },/* 0x47, RT_CHANNEL_DOMAIN_WORLD_ETSI6 */ + {0x00 },/* 0x48, RT_CHANNEL_DOMAIN_WORLD_ETSI7 */ + {0x00 },/* 0x49, RT_CHANNEL_DOMAIN_WORLD_ETSI8 */ + {0x00 },/* 0x50, RT_CHANNEL_DOMAIN_WORLD_ETSI9 */ + {0x00 },/* 0x51, RT_CHANNEL_DOMAIN_WORLD_ETSI10 */ + {0x00 },/* 0x52, RT_CHANNEL_DOMAIN_WORLD_ETSI11 */ + {0x02 },/* 0x53, RT_CHANNEL_DOMAIN_FCC1_NCC4 */ + {0x00 },/* 0x54, RT_CHANNEL_DOMAIN_WORLD_ETSI12 */ + {0x02 },/* 0x55, RT_CHANNEL_DOMAIN_FCC1_FCC9 */ + {0x00 },/* 0x56, RT_CHANNEL_DOMAIN_WORLD_ETSI13 */ + {0x02 },/* 0x57, RT_CHANNEL_DOMAIN_FCC1_FCC10 */ };/* use the combination for max channel numbers */ -static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03 ,0x02 }; +static RT_CHANNEL_PLAN_MAP RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x03 };/* Search the @param ch in given @param ch_set * @ch_set: the given channel set
@@ -231,23 +231,6 @@ int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch)return i; } -/* Check the @param ch is fit with setband setting of @param adapter -* @adapter: the given adapter -* @ch: the given channel number -* -* return true when check valid, false not valid -*/ -bool rtw_mlme_band_check (struct adapter *adapter,const u32 ch) -{ -if (adapter->setband ==GHZ24_50 /* 2.4G and 5G */ - || (adapter->setband ==GHZ_24 && ch <35 )/* 2.4G only */ - || (adapter->setband ==GHZ_50 && ch >35 )/* 5G only */ - ) { -return true; - } -return false; -} -/**************************************************************************** Following are the initialization functions for WiFi MLME
@@ -424,7 +407,6 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, RT_CHANNEL_else if ((channel_set[chanset_size].ChannelNum >=12 && channel_set[chanset_size].ChannelNum <=14 )) channel_set[chanset_size].ScanType =SCAN_PASSIVE ; }else if (RT_CHANNEL_DOMAIN_WORLD_WIDE_13 == ChannelPlan || -RT_CHANNEL_DOMAIN_WORLD_WIDE_5G == ChannelPlan ||RT_CHANNEL_DOMAIN_2G_WORLD == Index2G) {/* channel 12~13, passive scan */ if (channel_set[chanset_size].ChannelNum <=11 ) channel_set[chanset_size].ScanType =SCAN_ACTIVE ;
@@ -4938,10 +4920,6 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssidwhile ((i <MAX_CHANNEL_NUM ) && (chplan_new[i].ChannelNum !=0 )) {if (chplan_new[i].ChannelNum == channel) {if (chplan_new[i].ScanType ==SCAN_PASSIVE ) { -/* 5G Bnad 2, 3 (DFS) doesn't change to active scan */ -if (channel >=52 && channel <=144 ) -break ; - chplan_new[i].ScanType =SCAN_ACTIVE ; RT_TRACE(_module_rtl871x_mlme_c_, _drv_notice_, ("%s: change channel %d scan type from passive to active\n",
@@ -6250,7 +6228,6 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_c set_idx =rtw_ch_set_search_ch (pmlmeext->channel_set, in[i].hw_value);if (in[i].hw_value && !(in[i].flags &RTW_IEEE80211_CHAN_DISABLED ) && set_idx >=0 - &&rtw_mlme_band_check (padapter, in[i].hw_value) ) {if (j >= out_num) { DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" out_num:%u not enough\n",
@@ -6275,21 +6252,18 @@ static int rtw_scan_ch_decision(struct adapter *padapter, struct rtw_ieee80211_cDBG_871X (FUNC_ADPT_FMT " ch:%u\n" ,FUNC_ADPT_ARG (padapter), pmlmeext->channel_set[i].ChannelNum); -if (rtw_mlme_band_check (padapter, pmlmeext->channel_set[i].ChannelNum)) { - -if (j >= out_num) { -DBG_871X_LEVEL (_drv_always_,FUNC_ADPT_FMT " out_num:%u not enough\n" , -FUNC_ADPT_ARG (padapter), out_num); -break ; - } +if (j >= out_num) { +DBG_871X_LEVEL (_drv_always_,FUNC_ADPT_FMT " out_num:%u not enough\n" , +FUNC_ADPT_ARG (padapter), out_num); +break ; + } - out[j].hw_value = pmlmeext->channel_set[i].ChannelNum; + out[j].hw_value = pmlmeext->channel_set[i].ChannelNum; -if (pmlmeext->channel_set[i].ScanType ==SCAN_PASSIVE ) - out[j].flags |=RTW_IEEE80211_CHAN_PASSIVE_SCAN ; +if (pmlmeext->channel_set[i].ScanType ==SCAN_PASSIVE ) + out[j].flags |=RTW_IEEE80211_CHAN_PASSIVE_SCAN ; - j++; - } + j++; } }
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +0 -34
@@ -2062,139 +2062,105 @@ void Hal_ChannelPlanToRegulation(struct adapter *Adapter, u16 ChannelPlan)break ;case RT_CHANNEL_DOMAIN_FCC1_FCC1 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI1 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_MKK1_MKK1 : pHalData->Regulation2_4G =TXPWR_LMT_MKK ; - pHalData->Regulation5G =TXPWR_LMT_MKK ;break ;case RT_CHANNEL_DOMAIN_WORLD_KCC1 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_MKK ;break ;case RT_CHANNEL_DOMAIN_WORLD_FCC2 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_FCC3 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_FCC4 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_FCC5 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_FCC6 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_FCC1_FCC7 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI2 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI3 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_MKK1_MKK2 : pHalData->Regulation2_4G =TXPWR_LMT_MKK ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_MKK1_MKK3 : pHalData->Regulation2_4G =TXPWR_LMT_MKK ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_FCC1_NCC1 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_FCC1_NCC2 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_GLOBAL_NULL : pHalData->Regulation2_4G =TXPWR_LMT_WW ; - pHalData->Regulation5G =TXPWR_LMT_WW ;break ;case RT_CHANNEL_DOMAIN_ETSI1_ETSI4 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_FCC1_FCC2 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_FCC1_NCC3 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI5 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_FCC1_FCC8 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI6 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI7 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI8 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI9 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI10 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI11 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_FCC1_NCC4 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI12 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_FCC1_FCC9 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_WORLD_ETSI13 : pHalData->Regulation2_4G =TXPWR_LMT_ETSI ; - pHalData->Regulation5G =TXPWR_LMT_ETSI ;break ;case RT_CHANNEL_DOMAIN_FCC1_FCC10 : pHalData->Regulation2_4G =TXPWR_LMT_FCC ; - pHalData->Regulation5G =TXPWR_LMT_FCC ;break ;case RT_CHANNEL_DOMAIN_REALTEK_DEFINE :/* Realtek Reserve */ pHalData->Regulation2_4G =TXPWR_LMT_WW ; - pHalData->Regulation5G =TXPWR_LMT_WW ;break ;default :break ;
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +2 -4
@@ -255,7 +255,6 @@ typedef struct _RT_CHANNEL_PLAN_5G {typedef struct _RT_CHANNEL_PLAN_MAP {unsigned char Index2G; -unsigned char Index5G; }RT_CHANNEL_PLAN_MAP , *PRT_CHANNEL_PLAN_MAP ;enum Associated_AP {
@@ -360,13 +359,13 @@ struct FW_Sta_Info {* When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds. * Example: -* For chip supports 2.4G + 5GHz and AP mode is operating in channel 1, +* For chip supports 2.4G and AP mode is operating in channel 1, * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MILLISECOND is 3 and SURVEY_TO is 100. * When it's STA mode gets set_scan command, * it would * 1. Doing the scan on channel 1.2.3.4.5.6.7.8 * 2. Back to channel 1 for 300 milliseconds -* 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52 +* 3. Go through doing site survey on channel 9.10.11 * 4. Back to channel 1 for 300 milliseconds * 5. ... and so on, till survey done. */
@@ -423,7 +422,6 @@ typedef struct _RT_CHANNEL_INFO { }RT_CHANNEL_INFO , *PRT_CHANNEL_INFO ;int rtw_ch_set_search_ch (RT_CHANNEL_INFO *ch_set,const u32 ch); -bool rtw_mlme_band_check (struct adapter *adapter,const u32 ch);/* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ #define P2P_MAX_REG_CLASSES 10
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0 -2
@@ -77,7 +77,6 @@ static struct ieee80211_rate rtw_rates[] = {#define RTW_G_RATES_NUM 12#define RTW_2G_CHANNELS_NUM 14 -#define RTW_5G_CHANNELS_NUM 37static struct ieee80211_channel rtw_2ghz_channels[] = {CHAN2G (1 ,2412 ,0 ),
@@ -1422,7 +1421,6 @@ void rtw_cfg80211_surveydone_event_callback(struct adapter *padapter)/* report network only if the current channel set contains the channel to which this network belongs */ if (rtw_ch_set_search_ch (padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >=0 - &&rtw_mlme_band_check (padapter, pnetwork->network.Configuration.DSConfig) == true && true ==rtw_validate_ssid (&(pnetwork->network.Ssid)) ) {
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -1
@@ -1462,7 +1462,6 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a,/* report network only if the current channel set contains the channel to which this network belongs */ if (rtw_ch_set_search_ch (padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >=0 - &&rtw_mlme_band_check (padapter, pnetwork->network.Configuration.DSConfig) == true && true ==rtw_validate_ssid (&(pnetwork->network.Ssid))) { ev =translate_scan (padapter, a, pnetwork, ev, stop);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/8 staging: rtl8723bs: remove 5Ghz code blocks
In reply to Sasha LevinFrom: Fabio Aiuto <[email protected]>
[ Upstream commit ddd7c8b0033ba01a0ee605697f12a33fd31e6fca ]
remove 5 Ghz code blocks, related to networks
working over channel numbers above 14.
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 7 ++----- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 20 +++---------------- 2 files changed, 5 insertions(+), 22 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +2 -5
@@ -4116,7 +4116,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) p =rtw_get_ie (pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_);if ((p ==NULL ) || (len ==0 )) {/* non-HT */ -if ((pbss_network->Configuration.DSConfig <=0 ) || (pbss_network->Configuration.DSConfig >14 )) +if (pbss_network->Configuration.DSConfig <=0 )continue ;ICS [0 ][pbss_network->Configuration.DSConfig] =1 ;
@@ -6118,10 +6118,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf) {struct HT_info_element *pht_info = (struct HT_info_element *)(pIE->data); -if (pnetwork->Configuration.DSConfig >14 ) { -if ((pregpriv->bw_mode >>4 ) >CHANNEL_WIDTH_20 ) - cbw40_enable =1 ; - }else { +if (pnetwork->Configuration.DSConfig <=14 ) {if ((pregpriv->bw_mode &0x0f ) >CHANNEL_WIDTH_20 ) cbw40_enable =1 ; }
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +3 -17
@@ -135,14 +135,7 @@ static char *translate_scan(struct adapter *padapter,else snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11bg" ); }else { -if (pnetwork->network.Configuration.DSConfig >14 ) { -if (vht_cap) -snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11AC" ); -else if (ht_cap) -snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11an" ); -else -snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11a" ); - }else { +if (pnetwork->network.Configuration.DSConfig <=14 ) {if (ht_cap)snprintf (iwe.u.name,IFNAMSIZ ,"IEEE 802.11gn" );else
@@ -762,7 +755,7 @@ static int rtw_wx_get_name(struct net_device *dev,struct adapter *padapter = (struct adapter *)rtw_netdev_priv (dev);u32 ht_ielen =0 ;char *p; -u8 ht_cap = false, vht_cap = false; +u8 ht_cap = false;struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;NDIS_802_11_RATES_EX * prates =NULL ;
@@ -788,14 +781,7 @@ static int rtw_wx_get_name(struct net_device *dev,else snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11bg" ); }else { -if (pcur_bss->Configuration.DSConfig >14 ) { -if (vht_cap) -snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11AC" ); -else if (ht_cap) -snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11an" ); -else -snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11a" ); - }else { +if (pcur_bss->Configuration.DSConfig <=14 ) {if (ht_cap)snprintf (wrqu->name,IFNAMSIZ ,"IEEE 802.11gn" );else
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/8 staging: rtl8723bs: remove commented out condition
In reply to Sasha LevinFrom: Fabio Aiuto <[email protected]>
[ Upstream commit 2a62ff13132a22a754d042b2230117bbea0af477 ]
remove commented out condition checking channel > 14.
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +1 -1
@@ -165,7 +165,7 @@ static char *translate_scan(struct adapter *padapter, start =iwe_stream_add_event (info, start, stop, &iwe,IW_EV_UINT_LEN ); } -if (pnetwork->network.Configuration.DSConfig <1 /*|| pnetwork->network.Configuration.DSConfig > 14*/ ) +if (pnetwork->network.Configuration.DSConfig <1 ) pnetwork->network.Configuration.DSConfig =1 ;/* Add frequency/channel */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 7/8 staging: rtl8723bs: clean up comparsions to NULL
In reply to Sasha LevinFrom: Michael Straube <[email protected]>
[ Upstream commit cd1f1450092216b3e39516f8db58869b6fc20575 ]
Clean up comparsions to NULL reported by checkpatch.
x == NULL -> !x
x != NULL -> x
Stable-dep-of: a1fc19d61f66 ("staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()")
--- drivers/staging/rtl8723bs/core/rtw_ap.c | 20 ++-- drivers/staging/rtl8723bs/core/rtw_cmd.c | 96 +++++++++---------- .../staging/rtl8723bs/core/rtw_ioctl_set.c | 4 +- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 56 +++++------ drivers/staging/rtl8723bs/core/rtw_security.c | 6 +- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 24 ++--- .../staging/rtl8723bs/os_dep/ioctl_linux.c | 18 ++-- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 +- 9 files changed, 117 insertions(+), 117 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +10 -10
@@ -1033,7 +1033,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_) ); -if (p !=NULL ) { +if (p) {memcpy (supportRate, p +2 , ie_len); supportRateNum = ie_len; }
@@ -1045,7 +1045,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_ ); -if (p !=NULL ) { +if (p) {memcpy (supportRate + supportRateNum, p +2 , ie_len); supportRateNum += ie_len; }
@@ -1133,7 +1133,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)break ; } -if ((p ==NULL ) || (ie_len ==0 )) +if (!p || ie_len ==0 )break ; }
@@ -1162,7 +1162,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)break ; } -if ((p ==NULL ) || (ie_len ==0 )) +if (!p || ie_len ==0 )break ; } }
@@ -1290,7 +1290,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) psta =rtw_get_stainfo (&padapter->stapriv, pbss_network->MacAddress);if (!psta) { psta =rtw_alloc_stainfo (&padapter->stapriv, pbss_network->MacAddress); -if (psta ==NULL ) +if (!psta)return _FAIL; }
@@ -1447,7 +1447,7 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta) } psetstakey_para =rtw_zmalloc (sizeof (struct set_stakey_parm )); -if (psetstakey_para ==NULL ) { +if (!psetstakey_para) {kfree (ph2c); res = _FAIL; goto exit;
@@ -1485,12 +1485,12 @@ static int rtw_ap_set_key(/* DBG_871X("%s\n", __func__); */ pcmd =rtw_zmalloc (sizeof (struct cmd_obj )); -if (pcmd ==NULL ) { +if (!pcmd) { res = _FAIL; goto exit; } psetkeyparm =rtw_zmalloc (sizeof (struct setkey_parm )); -if (psetkeyparm ==NULL ) { +if (!psetkeyparm) {kfree (pcmd); res = _FAIL; goto exit;
@@ -1662,11 +1662,11 @@ static void update_bcn_wps_ie(struct adapter *padapter) &wps_ielen ); -if (pwps_ie ==NULL || wps_ielen ==0 ) +if (!pwps_ie || wps_ielen ==0 )return ; pwps_ie_src = pmlmepriv->wps_beacon_ie; -if (pwps_ie_src ==NULL ) +if (!pwps_ie_src)return ; wps_offset = (uint)(pwps_ie - ie);
drivers/staging/rtl8723bs/core/rtw_cmd.c +48 -48
363 lines not on this page · raw message
drivers/staging/rtl8723bs/core/rtw_ioctl_set.c +2 -2
@@ -508,7 +508,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_sRT_TRACE (_module_rtl871x_ioctl_set_c_, _drv_err_, ("+rtw_set_802_11_bssid_list_scan(), fw_state =%x\n" ,get_fwstate (pmlmepriv))); -if (padapter ==NULL ) { +if (!padapter) { res = false; goto exit; }
@@ -649,7 +649,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)return 0 ; psta =rtw_get_stainfo (&adapter->stapriv,get_bssid (pmlmepriv)); -if (psta ==NULL ) +if (!psta)return 0 ; short_GI =query_ra_short_GI (psta);
drivers/staging/rtl8723bs/core/rtw_mlme.c +3 -3
@@ -472,7 +472,7 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) pwlan = LIST_CONTAINOR(plist, struct wlan_network, list);if (!pwlan->fixed) { -if (oldest ==NULL ||time_after (oldest->last_scanned, pwlan->last_scanned)) +if (!oldest ||time_after (oldest->last_scanned, pwlan->last_scanned)) oldest = pwlan; }
@@ -603,7 +603,7 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t/* TODO: don't select netowrk in the same ess as oldest if it's new enough*/ } -if (oldest ==NULL ||time_after (oldest->last_scanned, pnetwork->last_scanned)) +if (!oldest ||time_after (oldest->last_scanned, pnetwork->last_scanned)) oldest = pnetwork; plist =get_next (plist);
@@ -2023,7 +2023,7 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme goto exit; } -if (*candidate ==NULL || (*candidate)->network.Rssi < competitor->network.Rssi) { +if (!*candidate || (*candidate)->network.Rssi < competitor->network.Rssi) { *candidate = competitor; updated = true; }
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +28 -28
216 lines not on this page · raw message
drivers/staging/rtl8723bs/core/rtw_security.c +3 -3
@@ -226,7 +226,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)struct security_priv *psecuritypriv = &padapter->securitypriv;struct xmit_priv *pxmitpriv = &padapter->xmitpriv; -if (((struct xmit_frame *)pxmitframe)->buf_addr ==NULL ) +if (!((struct xmit_frame *)pxmitframe)->buf_addr)return ; hw_hdr_offset =TXDESC_OFFSET ;
@@ -669,7 +669,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)struct xmit_priv *pxmitpriv = &padapter->xmitpriv;u32 res = _SUCCESS; -if (((struct xmit_frame *)pxmitframe)->buf_addr ==NULL ) +if (!((struct xmit_frame *)pxmitframe)->buf_addr)return _FAIL; hw_hdr_offset =TXDESC_OFFSET ;
@@ -1489,7 +1489,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)u32 res = _SUCCESS; -if (((struct xmit_frame *)pxmitframe)->buf_addr ==NULL ) +if (!((struct xmit_frame *)pxmitframe)->buf_addr)return _FAIL; hw_hdr_offset =TXDESC_OFFSET ;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +12 -12
@@ -418,7 +418,7 @@ void rtw_cfg80211_ibss_indicate_connect(struct adapter *padapter) }else { -if (scanned ==NULL ) { +if (!scanned) {rtw_warn_on (1 );return ; }
@@ -466,7 +466,7 @@ void rtw_cfg80211_indicate_connect(struct adapter *padapter)/* DBG_871X(FUNC_ADPT_FMT" BSS not found\n", FUNC_ADPT_ARG(padapter)); */ -if (scanned ==NULL ) { +if (!scanned) {rtw_warn_on (1 ); goto check_bss; }
@@ -597,7 +597,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } } -if (strcmp (param->u.crypt.alg,"none" ) ==0 && (psta ==NULL )) +if (strcmp (param->u.crypt.alg,"none" ) ==0 && !psta) {/* todo:clear default encryption keys */
@@ -607,7 +607,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_pa } -if (strcmp (param->u.crypt.alg,"WEP" ) ==0 && (psta ==NULL )) +if (strcmp (param->u.crypt.alg,"WEP" ) ==0 && !psta) {DBG_8192C ("r871x_set_encryption, crypt.alg = WEP\n" );
@@ -1001,7 +1001,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param } pbcmc_sta =rtw_get_bcmc_stainfo (padapter); -if (pbcmc_sta ==NULL ) +if (!pbcmc_sta) {/* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ }
@@ -1050,7 +1050,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, param_len =sizeof (struct ieee_param ) + params->key_len; param =rtw_malloc (param_len); -if (param ==NULL ) +if (!param)return -1 ;memset (param,0 , param_len);
@@ -1214,7 +1214,7 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy, } psta =rtw_get_stainfo (pstapriv, (u8 *)mac); -if (psta ==NULL ) { +if (!psta) {DBG_8192C ("%s, sta_info is null\n" , __func__); ret = -ENOENT ; goto exit;
@@ -1495,7 +1495,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphystruct rtw_wdev_priv *pwdev_priv;struct mlme_priv *pmlmepriv; -if (ndev ==NULL ) { +if (!ndev) { ret = -EINVAL ; goto exit; }
@@ -1783,7 +1783,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t ielu8 *pwpa, *pwpa2;u8 null_addr[] = {0 ,0 ,0 ,0 ,0 ,0 }; -if (pie ==NULL || !ielen) { +if (!pie || !ielen) {/* Treat this as normal case, but need to clear WIFI_UNDER_WPS */ _clr_fwstate_ (&padapter->mlmepriv,WIFI_UNDER_WPS ); goto exit;
@@ -1795,7 +1795,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel } buf =rtw_zmalloc (ielen); -if (buf ==NULL ) { +if (!buf) { ret = -ENOMEM ; goto exit; }
@@ -2138,7 +2138,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, wep_key_len = wep_key_len <=5 ?5 :13 ; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =rtw_malloc (wep_total_len); -if (pwep ==NULL ) { +if (!pwep) {DBG_871X (" wpa_set_encryption: pwep allocate fail !!!\n" ); ret = -ENOMEM ; goto exit;
@@ -3073,7 +3073,7 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,struct adapter *padapter;struct rtw_wdev_priv *pwdev_priv; -if (ndev ==NULL ) { +if (!ndev) { ret = -EINVAL ; goto exit; }
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +9 -9
@@ -519,7 +519,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,if (check_fwstate (pmlmepriv,WIFI_STATION_STATE |WIFI_MP_STATE ) == true) {/* sta mode */ psta =rtw_get_stainfo (pstapriv,get_bssid (pmlmepriv)); -if (psta ==NULL ) { +if (!psta) {/* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */ }else {/* Jeff: don't disable ieee8021x_blocked while clearing key */
@@ -578,7 +578,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, } pbcmc_sta =rtw_get_bcmc_stainfo (padapter); -if (pbcmc_sta ==NULL ) { +if (!pbcmc_sta) {/* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ }else {/* Jeff: don't disable ieee8021x_blocked while clearing key */
@@ -608,9 +608,9 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ieint ret =0 ;u8 null_addr[] = {0 ,0 ,0 ,0 ,0 ,0 }; -if ((ielen >MAX_WPA_IE_LEN ) || (pie ==NULL )) { +if (ielen >MAX_WPA_IE_LEN || !pie) {_clr_fwstate_ (&padapter->mlmepriv,WIFI_UNDER_WPS ); -if (pie ==NULL ) +if (!pie)return ret;else return -EINVAL ;
@@ -618,7 +618,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ieif (ielen) { buf =rtw_zmalloc (ielen); -if (buf ==NULL ) { +if (!buf) { ret = -ENOMEM ; goto exit; }
@@ -3366,7 +3366,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)return -EINVAL ; param =rtw_malloc (p->length); -if (param ==NULL ) +if (!param)return -ENOMEM ;if (copy_from_user (param, p->pointer, p->length)) {
@@ -3448,7 +3448,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } } -if (strcmp (param->u.crypt.alg,"none" ) ==0 && (psta ==NULL )) { +if (strcmp (param->u.crypt.alg,"none" ) ==0 && !psta) {/* todo:clear default encryption keys */ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
@@ -3462,7 +3462,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } -if (strcmp (param->u.crypt.alg,"WEP" ) ==0 && (psta ==NULL )) { +if (strcmp (param->u.crypt.alg,"WEP" ) ==0 && !psta) {DBG_871X ("r871x_set_encryption, crypt.alg = WEP\n" ); wep_key_idx = param->u.crypt.idx;
@@ -4187,7 +4187,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)return -EINVAL ; param =rtw_malloc (p->length); -if (param ==NULL ) +if (!param)return -ENOMEM ;if (copy_from_user (param, p->pointer, p->length)) {
drivers/staging/rtl8723bs/os_dep/os_intfs.c +2 -2
@@ -525,7 +525,7 @@ void rtw_unregister_netdevs(struct dvobj_priv *dvobj) padapter = dvobj->padapters; -if (padapter ==NULL ) +if (!padapter)return ; pnetdev = padapter->pnetdev;
@@ -638,7 +638,7 @@ struct dvobj_priv *devobj_init(void)struct dvobj_priv *pdvobj =NULL ; pdvobj =rtw_zmalloc (sizeof (*pdvobj)); -if (pdvobj ==NULL ) +if (!pdvobj)return NULL ;mutex_init (&pdvobj->hw_init_mutex);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 8/8 staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth()
In reply to Sasha LevinFrom: Alexandru Hossu <[email protected]>
[ Upstream commit a1fc19d61f661d47204f095b593de507884849f7 ]
OnAuth() has two bugs in the shared-key authentication path.
When the Privacy bit is set, rtw_wep_decrypt() is called without verifying that the frame is long enough to contain a valid WEP IV and ICV. Inside rtw_wep_decrypt(), length is computed as:
length = len - WLAN_HDR_A3_LEN - iv_len
and then passed as (length - 4) to crc32_le(). If len is less than WLAN_HDR_A3_LEN + iv_len + icv_len (32 bytes), length - 4 is negative and, after the implicit cast to size_t, causes crc32_le() to read far beyond the frame buffer. Add a minimum length check before accessing the IV field and calling the decryption path.
When processing a seq=3 response, rtw_get_ie() stores the Challenge Text IE length in ie_len, but the subsequent memcmp() always reads 128 bytes regardless of ie_len. IEEE 802.11 mandates a challenge text of exactly 128 bytes; reject any IE whose length field differs, matching the check already applied to OnAuthClient().
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +7 -1
@@ -886,6 +886,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)DBG_871X ("+OnAuth\n" ); +if (len <WLAN_HDR_A3_LEN ) +return _FAIL; + sa =GetAddr2Ptr (pframe); auth_mode = psecuritypriv->dot11AuthAlgrthm;
@@ -897,6 +900,9 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) prxattrib->hdrlen =WLAN_HDR_A3_LEN ; prxattrib->encrypt = _WEP40_; +if (len <WLAN_HDR_A3_LEN +8 ) +return _FAIL; + iv = pframe+prxattrib->hdrlen; prxattrib->key_index = ((iv[3 ]>>6 )&0x3 );
@@ -1014,7 +1020,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame) p =rtw_get_ie (pframe +WLAN_HDR_A3_LEN +4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len, len -WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ -4 ); -if (!p || ie_len <=0 ) { +if (!p || ie_len !=128 ) {DBG_871X ("auth rejected because challenge failure!(1)\n" ); status = _STATS_CHALLENGE_FAIL_; goto auth_fail;
Signature · 1 line
2.53.0