diff mbox series

mac80211: allocate tailroom for forwarded mesh packets

Message ID 20190222122115.68485-1-nbd@nbd.name (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series mac80211: allocate tailroom for forwarded mesh packets | expand

Commit Message

Felix Fietkau Feb. 22, 2019, 12:21 p.m. UTC
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: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/rx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Sasha Levin Feb. 26, 2019, 9:23 p.m. UTC | #1
Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v4.20.12, v4.19.25, v4.14.103, v4.9.160, v4.4.176, v3.18.136.

v4.20.12: Build OK!
v4.19.25: Build OK!
v4.14.103: Failed to apply! Possible dependencies:
    0c3d5a96d5e5 ("net: drivers/net: Remove unnecessary skb_copy_expand OOM messages")

v4.9.160: Failed to apply! Possible dependencies:
    0c3d5a96d5e5 ("net: drivers/net: Remove unnecessary skb_copy_expand OOM messages")
    c38c39bf7cc0 ("mac80211: Fix headroom allocation when forwarding mesh pkt")
    d8da0b5d64d5 ("mac80211: Ensure enough headroom when forwarding mesh pkt")

v4.4.176: Failed to apply! Possible dependencies:
    0c3d5a96d5e5 ("net: drivers/net: Remove unnecessary skb_copy_expand OOM messages")
    c38c39bf7cc0 ("mac80211: Fix headroom allocation when forwarding mesh pkt")
    d8da0b5d64d5 ("mac80211: Ensure enough headroom when forwarding mesh pkt")

v3.18.136: Failed to apply! Possible dependencies:
    0c3d5a96d5e5 ("net: drivers/net: Remove unnecessary skb_copy_expand OOM messages")
    c38c39bf7cc0 ("mac80211: Fix headroom allocation when forwarding mesh pkt")
    d8da0b5d64d5 ("mac80211: Ensure enough headroom when forwarding mesh pkt")


How should we proceed with this patch?

--
Thanks,
Sasha
diff mbox series

Patch

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 45aad3d3108c..d78c106ef314 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2644,6 +2644,7 @@  ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	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);
@@ -2730,8 +2731,12 @@  ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	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;