6db41daf451037dbb7f0a8dbbd26b4502cbcaa73
[oweals/openwrt.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 22 Feb 2019 13:21:15 +0100
3 Subject: [PATCH] mac80211: allocate tailroom for forwarded mesh packets
4
5 Forwarded packets enter the tx path through ieee80211_add_pending_skb,
6 which skips the ieee80211_skb_resize call.
7 Fixes WARN_ON in ccmp_encrypt_skb and resulting packet loss.
8
9 Cc: stable@vger.kernel.org
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 ---
13
14 --- a/net/mac80211/rx.c
15 +++ b/net/mac80211/rx.c
16 @@ -2598,6 +2598,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
17         struct ieee80211_sub_if_data *sdata = rx->sdata;
18         struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
19         u16 ac, q, hdrlen;
20 +       int tailroom = 0;
21  
22         hdr = (struct ieee80211_hdr *) skb->data;
23         hdrlen = ieee80211_hdrlen(hdr->frame_control);
24 @@ -2684,8 +2685,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
25         if (!ifmsh->mshcfg.dot11MeshForwarding)
26                 goto out;
27  
28 +       if (sdata->crypto_tx_tailroom_needed_cnt)
29 +               tailroom = IEEE80211_ENCRYPT_TAILROOM;
30 +
31         fwd_skb = skb_copy_expand(skb, local->tx_headroom +
32 -                                      sdata->encrypt_headroom, 0, GFP_ATOMIC);
33 +                                      sdata->encrypt_headroom,
34 +                                 tailroom, GFP_ATOMIC);
35         if (!fwd_skb)
36                 goto out;
37