Commit 0b218f4c authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: rtl8723a_cmd.c: Properly initialize seq_ctrl

Control frames will not be fragmented, so we should fully initialize
the seq_ctrl field to zero. This avoids leftover stack bits remaining
set in the generated frame's seq_ctrl field.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1daffaee
...@@ -204,7 +204,6 @@ void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode) ...@@ -204,7 +204,6 @@ void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode)
static void ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLength) static void ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLength)
{ {
struct ieee80211_hdr *pwlanhdr; struct ieee80211_hdr *pwlanhdr;
__le16 *fctrl;
u32 rate_len, pktlen; u32 rate_len, pktlen;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
...@@ -216,15 +215,15 @@ static void ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLeng ...@@ -216,15 +215,15 @@ static void ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLeng
pwlanhdr = (struct ieee80211_hdr *)pframe; pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &pwlanhdr->frame_control; pwlanhdr->frame_control = 0;
*(fctrl) = 0;
memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN);
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, get_my_bssid23a(cur_network), ETH_ALEN); memcpy(pwlanhdr->addr3, get_my_bssid23a(cur_network), ETH_ALEN);
SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); /* A Beacon frame shouldn't have fragment bits set */
/* pmlmeext->mgnt_seq++; */ pwlanhdr->seq_ctrl = 0;
SetFrameSubType(pframe, WIFI_BEACON); SetFrameSubType(pframe, WIFI_BEACON);
pframe += sizeof(struct ieee80211_hdr_3addr); pframe += sizeof(struct ieee80211_hdr_3addr);
...@@ -334,28 +333,26 @@ static void ConstructPSPoll(struct rtw_adapter *padapter, u8 *pframe, u32 *pLeng ...@@ -334,28 +333,26 @@ static void ConstructPSPoll(struct rtw_adapter *padapter, u8 *pframe, u32 *pLeng
*pLength = 16; *pLength = 16;
} }
static void ConstructNullFunctionData( static void
struct rtw_adapter *padapter, ConstructNullFunctionData(struct rtw_adapter *padapter, u8 *pframe,
u8 *pframe, u32 *pLength, u8 *StaAddr, u8 bQoS, u8 AC,
u32 *pLength, u8 bEosp, u8 bForcePowerSave)
u8 *StaAddr,
u8 bQoS,
u8 AC,
u8 bEosp,
u8 bForcePowerSave)
{ {
struct ieee80211_hdr *pwlanhdr; struct ieee80211_hdr *pwlanhdr;
__le16 *fctrl; __le16 *fctrl;
u32 pktlen; u32 pktlen;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_network *cur_network = &pmlmepriv->cur_network; struct wlan_network *cur_network = &pmlmepriv->cur_network;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
pwlanhdr = (struct ieee80211_hdr *)pframe; pwlanhdr = (struct ieee80211_hdr *)pframe;
pwlanhdr->frame_control = 0;
pwlanhdr->seq_ctrl = 0;
fctrl = &pwlanhdr->frame_control; fctrl = &pwlanhdr->frame_control;
*(fctrl) = 0;
if (bForcePowerSave) if (bForcePowerSave)
SetPwrMgt(fctrl); SetPwrMgt(fctrl);
...@@ -387,8 +384,6 @@ static void ConstructNullFunctionData( ...@@ -387,8 +384,6 @@ static void ConstructNullFunctionData(
break; break;
} }
SetSeqNum(pwlanhdr, 0);
if (bQoS == true) { if (bQoS == true) {
struct ieee80211_qos_hdr *pwlanqoshdr; struct ieee80211_qos_hdr *pwlanqoshdr;
...@@ -408,10 +403,10 @@ static void ConstructNullFunctionData( ...@@ -408,10 +403,10 @@ static void ConstructNullFunctionData(
*pLength = pktlen; *pLength = pktlen;
} }
static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe,
u32 *pLength, u8 *StaAddr, bool bHideSSID)
{ {
struct ieee80211_hdr *pwlanhdr; struct ieee80211_hdr *pwlanhdr;
__le16 *fctrl;
u8 *mac, *bssid; u8 *mac, *bssid;
u32 pktlen; u32 pktlen;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
...@@ -425,14 +420,14 @@ static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe, u32 *pLe ...@@ -425,14 +420,14 @@ static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe, u32 *pLe
mac = myid(&padapter->eeprompriv); mac = myid(&padapter->eeprompriv);
bssid = cur_network->MacAddress; bssid = cur_network->MacAddress;
fctrl = &pwlanhdr->frame_control; pwlanhdr->frame_control = 0;
*(fctrl) = 0; pwlanhdr->seq_ctrl = 0;
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
memcpy(pwlanhdr->addr2, mac, ETH_ALEN); memcpy(pwlanhdr->addr2, mac, ETH_ALEN);
memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); memcpy(pwlanhdr->addr3, bssid, ETH_ALEN);
SetSeqNum(pwlanhdr, 0); SetFrameSubType(&pwlanhdr->frame_control, WIFI_PROBERSP);
SetFrameSubType(fctrl, WIFI_PROBERSP);
pktlen = sizeof(struct ieee80211_hdr_3addr); pktlen = sizeof(struct ieee80211_hdr_3addr);
pframe += pktlen; pframe += pktlen;
...@@ -521,13 +516,13 @@ static void SetFwRsvdPagePkt(struct rtw_adapter *padapter, bool bDLFinished) ...@@ -521,13 +516,13 @@ static void SetFwRsvdPagePkt(struct rtw_adapter *padapter, bool bDLFinished)
/* 3 (3) null data */ /* 3 (3) null data */
RsvdPageLoc.LocNullData = PageNum; RsvdPageLoc.LocNullData = PageNum;
ConstructNullFunctionData( ConstructNullFunctionData(padapter, &ReservedPagePacket[BufIndex],
padapter, &NullDataLength,
&ReservedPagePacket[BufIndex], get_my_bssid23a(&pmlmeinfo->network),
&NullDataLength, false, 0, 0, false);
get_my_bssid23a(&pmlmeinfo->network), rtl8723a_fill_fake_txdesc(padapter,
false, 0, 0, false); &ReservedPagePacket[BufIndex-TxDescLen],
rtl8723a_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, false, false); NullDataLength, false, false);
PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength); PageNeed = (u8)PageNum_128(TxDescLen + NullDataLength);
PageNum += PageNeed; PageNum += PageNeed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment