staging: rtl8712u: Fix endian settings for structs describing network packets
authorLarry Finger <Larry.Finger@lwfinger.net>
Sat, 7 Oct 2017 22:37:45 +0000 (22:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2017 09:06:29 +0000 (10:06 +0100)
[ 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>
drivers/staging/rtl8712/ieee80211.h

index d374824c4f330a6d316d44b74b833593b40f56f9..7b16c05b5e8bf6665e793be91d6c3c400765e13d 100644 (file)
@@ -143,52 +143,52 @@ struct ieee_ibss_seq {
 };
 
 struct ieee80211_hdr {
-       u16 frame_ctl;
-       u16 duration_id;
+       __le16 frame_ctl;
+       __le16 duration_id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
        u8 addr3[ETH_ALEN];
-       u16 seq_ctl;
+       __le16 seq_ctl;
        u8 addr4[ETH_ALEN];
-} __packed;
+}  __packed __aligned(2);
 
 struct ieee80211_hdr_3addr {
-       u16 frame_ctl;
-       u16 duration_id;
+       __le16 frame_ctl;
+       __le16 duration_id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
        u8 addr3[ETH_ALEN];
-       u16 seq_ctl;
-} __packed;
+       __le16 seq_ctl;
+}  __packed __aligned(2);
 
 
 struct ieee80211_hdr_qos {
-       u16 frame_ctl;
-       u16 duration_id;
+       __le16 frame_ctl;
+       __le16 duration_id;
        u8 addr1[ETH_ALEN];
        u8 addr2[ETH_ALEN];
        u8 addr3[ETH_ALEN];
-       u16 seq_ctl;
+       __le16 seq_ctl;
        u8 addr4[ETH_ALEN];
-       u16     qc;
-}  __packed;
+       __le16  qc;
+}   __packed __aligned(2);
 
 struct  ieee80211_hdr_3addr_qos {
-       u16 frame_ctl;
-       u16 duration_id;
+       __le16 frame_ctl;
+       __le16 duration_id;
        u8  addr1[ETH_ALEN];
        u8  addr2[ETH_ALEN];
        u8  addr3[ETH_ALEN];
-       u16 seq_ctl;
-       u16 qc;
+       __le16 seq_ctl;
+       __le16 qc;
 }  __packed;
 
 struct eapol {
        u8 snap[6];
-       u16 ethertype;
+       __be16 ethertype;
        u8 version;
        u8 type;
-       u16 length;
+       __le16 length;
 } __packed;
 
 
@@ -528,13 +528,13 @@ struct ieee80211_security {
  */
 
 struct ieee80211_header_data {
-       u16 frame_ctl;
-       u16 duration_id;
+       __le16 frame_ctl;
+       __le16 duration_id;
        u8 addr1[6];
        u8 addr2[6];
        u8 addr3[6];
-       u16 seq_ctrl;
-};
+       __le16 seq_ctrl;
+} __packed __aligned(2);
 
 #define BEACON_PROBE_SSID_ID_POSITION 12
 
@@ -566,18 +566,18 @@ struct ieee80211_info_element {
 /*
  * These are the data types that can make up management packets
  *
-       u16 auth_algorithm;
-       u16 auth_sequence;
-       u16 beacon_interval;
-       u16 capability;
+       __le16 auth_algorithm;
+       __le16 auth_sequence;
+       __le16 beacon_interval;
+       __le16 capability;
        u8 current_ap[ETH_ALEN];
-       u16 listen_interval;
+       __le16 listen_interval;
        struct {
                u16 association_id:14, reserved:2;
        } __packed;
-       u32 time_stamp[2];
-       u16 reason;
-       u16 status;
+       __le32 time_stamp[2];
+       __le16 reason;
+       __le16 status;
 */
 
 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
@@ -585,16 +585,16 @@ struct ieee80211_info_element {
 
 struct ieee80211_authentication {
        struct ieee80211_header_data header;
-       u16 algorithm;
-       u16 transaction;
-       u16 status;
+       __le16 algorithm;
+       __le16 transaction;
+       __le16 status;
 } __packed;
 
 struct ieee80211_probe_response {
        struct ieee80211_header_data header;
-       u32 time_stamp[2];
-       u16 beacon_interval;
-       u16 capability;
+       __le32 time_stamp[2];
+       __le16 beacon_interval;
+       __le16 capability;
        struct ieee80211_info_element info_element;
 } __packed;
 
@@ -604,16 +604,16 @@ struct ieee80211_probe_request {
 
 struct ieee80211_assoc_request_frame {
        struct ieee80211_hdr_3addr header;
-       u16 capability;
-       u16 listen_interval;
+       __le16 capability;
+       __le16 listen_interval;
        struct ieee80211_info_element_hdr info_element;
 } __packed;
 
 struct ieee80211_assoc_response_frame {
        struct ieee80211_hdr_3addr header;
-       u16 capability;
-       u16 status;
-       u16 aid;
+       __le16 capability;
+       __le16 status;
+       __le16 aid;
 } __packed;
 
 struct ieee80211_txb {