]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ieee802154: fix skb get fc on big endian
authorAlexander Aring <aar@pengutronix.de>
Wed, 6 Jul 2016 21:32:27 +0000 (23:32 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Jul 2016 11:23:12 +0000 (13:23 +0200)
This patch fixes ieee802154_get_fc_from_skb function on big endian
machines. The function get_unaligned_le16 converts the byte order to
host byte order but we want to keep the byte order like in mac header.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/mac802154.h

index d757edd0b0b70b7f2e39aea9b4471fd05bf6c3c4..bb7bfecc5ab3d10537a4eac10f6ef34010c1a7ab 100644 (file)
@@ -247,6 +247,8 @@ struct ieee802154_ops {
  */
 static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
 {
+       __le16 fc;
+
        /* check if we can fc at skb_mac_header of sk buffer */
        if (unlikely(!skb_mac_header_was_set(skb) ||
                     (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) {
@@ -254,7 +256,8 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
                return cpu_to_le16(0);
        }
 
-       return get_unaligned_le16(skb_mac_header(skb));
+       memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
+       return fc;
 }
 
 /**