Commit aaa7088e authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

ieee802154: fix skb get fc on big endian

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: default avatarAlexander Aring <aar@pengutronix.de>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0ea0b9af
...@@ -247,6 +247,8 @@ struct ieee802154_ops { ...@@ -247,6 +247,8 @@ struct ieee802154_ops {
*/ */
static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) 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 */ /* check if we can fc at skb_mac_header of sk buffer */
if (unlikely(!skb_mac_header_was_set(skb) || if (unlikely(!skb_mac_header_was_set(skb) ||
(skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { (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) ...@@ -254,7 +256,8 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
return cpu_to_le16(0); return cpu_to_le16(0);
} }
return get_unaligned_le16(skb_mac_header(skb)); memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
return fc;
} }
/** /**
......
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