mac80211: allocate tailroom for forwarded mesh packets [Linux 5.0]

mac80211: allocate tailroom for forwarded mesh packets [Linux 5.0]

This Linux kernel change "mac80211: allocate tailroom for forwarded mesh packets" is included in the Linux 5.0 release. This change is authored by Felix Fietkau <nbd [at]> on Fri Feb 22 13:21:15 2019 +0100. The commit for this change in Linux stable tree is 51d0af2 (patch).

mac80211: allocate tailroom for forwarded mesh packets

Forwarded packets enter the tx path through ieee80211_add_pending_skb,
which skips the ieee80211_skb_resize call.
Fixes WARN_ON in ccmp_encrypt_skb and resulting packet loss.

Cc: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/mac80211/rx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bb4d71e..c2a6da5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2644,6 +2644,7 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
    struct ieee80211_sub_if_data *sdata = rx->sdata;
    struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
    u16 ac, q, hdrlen;
+   int tailroom = 0;

    hdr = (struct ieee80211_hdr *) skb->data;
    hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -2732,8 +2733,12 @@ static void ieee80211_deliver_skb_to_local_stack(struct sk_buff *skb,
    if (!ifmsh->mshcfg.dot11MeshForwarding)
        goto out;

+   if (sdata->crypto_tx_tailroom_needed_cnt)
+       tailroom = IEEE80211_ENCRYPT_TAILROOM;
    fwd_skb = skb_copy_expand(skb, local->tx_headroom +
-                      sdata->encrypt_headroom, 0, GFP_ATOMIC);
+                      sdata->encrypt_headroom,
+                 tailroom, GFP_ATOMIC);
    if (!fwd_skb)
        goto out;

Leave a Reply

Your email address will not be published. Required fields are marked *