Skip to content

Commit 7dd111e

Browse files
committed
wireless: drop invalid mesh address extension frames
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. Cc: [email protected] Reviewed-by: Javier Cardona <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent badecb0 commit 7dd111e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/wireless/util.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,15 @@ EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
312312
static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
313313
{
314314
int ae = meshhdr->flags & MESH_FLAGS_AE;
315-
/* 7.1.3.5a.2 */
315+
/* 802.11-2012, 8.2.4.7.3 */
316316
switch (ae) {
317+
default:
317318
case 0:
318319
return 6;
319320
case MESH_FLAGS_AE_A4:
320321
return 12;
321322
case MESH_FLAGS_AE_A5_A6:
322323
return 18;
323-
case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
324-
return 24;
325-
default:
326-
return 6;
327324
}
328325
}
329326

@@ -373,6 +370,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
373370
/* make sure meshdr->flags is on the linear part */
374371
if (!pskb_may_pull(skb, hdrlen + 1))
375372
return -1;
373+
if (meshdr->flags & MESH_FLAGS_AE_A4)
374+
return -1;
376375
if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
377376
skb_copy_bits(skb, hdrlen +
378377
offsetof(struct ieee80211s_hdr, eaddr1),
@@ -397,6 +396,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
397396
/* make sure meshdr->flags is on the linear part */
398397
if (!pskb_may_pull(skb, hdrlen + 1))
399398
return -1;
399+
if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
400+
return -1;
400401
if (meshdr->flags & MESH_FLAGS_AE_A4)
401402
skb_copy_bits(skb, hdrlen +
402403
offsetof(struct ieee80211s_hdr, eaddr1),

0 commit comments

Comments
 (0)