Commit 38f0512e authored by Johannes Berg's avatar Johannes Berg Committed by Ben Hutchings

wireless: drop invalid mesh address extension frames

commit 7dd111e8 upstream.

The mesh header can have address extension by a 4th
or a 5th and 6th address, but never both. Drop such
frames in 802.11 -> 802.3 conversion along with any
frames that have the wrong extension.
Reviewed-by: default avatarJavier Cardona <javier@cozybit.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent e03a4913
...@@ -304,18 +304,15 @@ EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); ...@@ -304,18 +304,15 @@ EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
{ {
int ae = meshhdr->flags & MESH_FLAGS_AE; int ae = meshhdr->flags & MESH_FLAGS_AE;
/* 7.1.3.5a.2 */ /* 802.11-2012, 8.2.4.7.3 */
switch (ae) { switch (ae) {
default:
case 0: case 0:
return 6; return 6;
case MESH_FLAGS_AE_A4: case MESH_FLAGS_AE_A4:
return 12; return 12;
case MESH_FLAGS_AE_A5_A6: case MESH_FLAGS_AE_A5_A6:
return 18; return 18;
case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
return 24;
default:
return 6;
} }
} }
...@@ -365,6 +362,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, ...@@ -365,6 +362,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
/* make sure meshdr->flags is on the linear part */ /* make sure meshdr->flags is on the linear part */
if (!pskb_may_pull(skb, hdrlen + 1)) if (!pskb_may_pull(skb, hdrlen + 1))
return -1; return -1;
if (meshdr->flags & MESH_FLAGS_AE_A4)
return -1;
if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
skb_copy_bits(skb, hdrlen + skb_copy_bits(skb, hdrlen +
offsetof(struct ieee80211s_hdr, eaddr1), offsetof(struct ieee80211s_hdr, eaddr1),
...@@ -389,6 +388,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, ...@@ -389,6 +388,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
/* make sure meshdr->flags is on the linear part */ /* make sure meshdr->flags is on the linear part */
if (!pskb_may_pull(skb, hdrlen + 1)) if (!pskb_may_pull(skb, hdrlen + 1))
return -1; return -1;
if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
return -1;
if (meshdr->flags & MESH_FLAGS_AE_A4) if (meshdr->flags & MESH_FLAGS_AE_A4)
skb_copy_bits(skb, hdrlen + skb_copy_bits(skb, hdrlen +
offsetof(struct ieee80211s_hdr, eaddr1), offsetof(struct ieee80211s_hdr, eaddr1),
......
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