Skip to content

Commit a76eb0e

Browse files
lwfingergregkh
authored andcommitted
staging: rtl8712u: Fix endian settings for structs describing network packets
[ Upstream commit 221c46d28957bd6e2158abc2179ce4a8c9ce07d3 ] The headers describing a number of network packets do not have the correct endian settings for several types of data. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f9776d7 commit a76eb0e

1 file changed

Lines changed: 42 additions & 42 deletions

File tree

drivers/staging/rtl8712/ieee80211.h

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -143,52 +143,52 @@ struct ieee_ibss_seq {
143143
};
144144

145145
struct ieee80211_hdr {
146-
u16 frame_ctl;
147-
u16 duration_id;
146+
__le16 frame_ctl;
147+
__le16 duration_id;
148148
u8 addr1[ETH_ALEN];
149149
u8 addr2[ETH_ALEN];
150150
u8 addr3[ETH_ALEN];
151-
u16 seq_ctl;
151+
__le16 seq_ctl;
152152
u8 addr4[ETH_ALEN];
153-
} __packed;
153+
} __packed __aligned(2);
154154

155155
struct ieee80211_hdr_3addr {
156-
u16 frame_ctl;
157-
u16 duration_id;
156+
__le16 frame_ctl;
157+
__le16 duration_id;
158158
u8 addr1[ETH_ALEN];
159159
u8 addr2[ETH_ALEN];
160160
u8 addr3[ETH_ALEN];
161-
u16 seq_ctl;
162-
} __packed;
161+
__le16 seq_ctl;
162+
} __packed __aligned(2);
163163

164164

165165
struct ieee80211_hdr_qos {
166-
u16 frame_ctl;
167-
u16 duration_id;
166+
__le16 frame_ctl;
167+
__le16 duration_id;
168168
u8 addr1[ETH_ALEN];
169169
u8 addr2[ETH_ALEN];
170170
u8 addr3[ETH_ALEN];
171-
u16 seq_ctl;
171+
__le16 seq_ctl;
172172
u8 addr4[ETH_ALEN];
173-
u16 qc;
174-
} __packed;
173+
__le16 qc;
174+
} __packed __aligned(2);
175175

176176
struct ieee80211_hdr_3addr_qos {
177-
u16 frame_ctl;
178-
u16 duration_id;
177+
__le16 frame_ctl;
178+
__le16 duration_id;
179179
u8 addr1[ETH_ALEN];
180180
u8 addr2[ETH_ALEN];
181181
u8 addr3[ETH_ALEN];
182-
u16 seq_ctl;
183-
u16 qc;
182+
__le16 seq_ctl;
183+
__le16 qc;
184184
} __packed;
185185

186186
struct eapol {
187187
u8 snap[6];
188-
u16 ethertype;
188+
__be16 ethertype;
189189
u8 version;
190190
u8 type;
191-
u16 length;
191+
__le16 length;
192192
} __packed;
193193

194194

@@ -528,13 +528,13 @@ struct ieee80211_security {
528528
*/
529529

530530
struct ieee80211_header_data {
531-
u16 frame_ctl;
532-
u16 duration_id;
531+
__le16 frame_ctl;
532+
__le16 duration_id;
533533
u8 addr1[6];
534534
u8 addr2[6];
535535
u8 addr3[6];
536-
u16 seq_ctrl;
537-
};
536+
__le16 seq_ctrl;
537+
} __packed __aligned(2);
538538

539539
#define BEACON_PROBE_SSID_ID_POSITION 12
540540

@@ -566,35 +566,35 @@ struct ieee80211_info_element {
566566
/*
567567
* These are the data types that can make up management packets
568568
*
569-
u16 auth_algorithm;
570-
u16 auth_sequence;
571-
u16 beacon_interval;
572-
u16 capability;
569+
__le16 auth_algorithm;
570+
__le16 auth_sequence;
571+
__le16 beacon_interval;
572+
__le16 capability;
573573
u8 current_ap[ETH_ALEN];
574-
u16 listen_interval;
574+
__le16 listen_interval;
575575
struct {
576576
u16 association_id:14, reserved:2;
577577
} __packed;
578-
u32 time_stamp[2];
579-
u16 reason;
580-
u16 status;
578+
__le32 time_stamp[2];
579+
__le16 reason;
580+
__le16 status;
581581
*/
582582

583583
#define IEEE80211_DEFAULT_TX_ESSID "Penguin"
584584
#define IEEE80211_DEFAULT_BASIC_RATE 10
585585

586586
struct ieee80211_authentication {
587587
struct ieee80211_header_data header;
588-
u16 algorithm;
589-
u16 transaction;
590-
u16 status;
588+
__le16 algorithm;
589+
__le16 transaction;
590+
__le16 status;
591591
} __packed;
592592

593593
struct ieee80211_probe_response {
594594
struct ieee80211_header_data header;
595-
u32 time_stamp[2];
596-
u16 beacon_interval;
597-
u16 capability;
595+
__le32 time_stamp[2];
596+
__le16 beacon_interval;
597+
__le16 capability;
598598
struct ieee80211_info_element info_element;
599599
} __packed;
600600

@@ -604,16 +604,16 @@ struct ieee80211_probe_request {
604604

605605
struct ieee80211_assoc_request_frame {
606606
struct ieee80211_hdr_3addr header;
607-
u16 capability;
608-
u16 listen_interval;
607+
__le16 capability;
608+
__le16 listen_interval;
609609
struct ieee80211_info_element_hdr info_element;
610610
} __packed;
611611

612612
struct ieee80211_assoc_response_frame {
613613
struct ieee80211_hdr_3addr header;
614-
u16 capability;
615-
u16 status;
616-
u16 aid;
614+
__le16 capability;
615+
__le16 status;
616+
__le16 aid;
617617
} __packed;
618618

619619
struct ieee80211_txb {

0 commit comments

Comments
 (0)