* [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt
@ 2016-12-06 12:23 Cedric Izoard
2016-12-07 9:40 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Cedric Izoard @ 2016-12-06 12:23 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: Laurent Trarieux
When a buffer is duplicated during MESH packet forwarding,
this patch ensures that the new buffer has enough headroom.
Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
---
net/mac80211/rx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d2a00f2..1ed32b4 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2468,7 +2468,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
if (!ifmsh->mshcfg.dot11MeshForwarding)
goto out;
- fwd_skb = skb_copy(skb, GFP_ATOMIC);
+ if (skb_headroom(skb) >= local->tx_headroom)
+ fwd_skb = skb_copy(skb, GFP_ATOMIC);
+ else
+ fwd_skb = skb_copy_expand(skb, local->tx_headroom,
+ 0, GFP_ATOMIC);
if (!fwd_skb) {
net_info_ratelimited("%s: failed to clone mesh frame\n",
sdata->name);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt
2016-12-06 12:23 [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt Cedric Izoard
@ 2016-12-07 9:40 ` Johannes Berg
2016-12-07 9:57 ` Cedric Izoard
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2016-12-07 9:40 UTC (permalink / raw)
To: Cedric Izoard, linux-wireless@vger.kernel.org; +Cc: Laurent Trarieux
> - fwd_skb = skb_copy(skb, GFP_ATOMIC);
> + if (skb_headroom(skb) >= local->tx_headroom)
> + fwd_skb = skb_copy(skb, GFP_ATOMIC);
> + else
> + fwd_skb = skb_copy_expand(skb, local->tx_headroom,
> + 0, GFP_ATOMIC);
Why bother making this conditional? It seems that always using
skb_copy_expand() should be sufficient? The code between the two
(skb_copy, skb_copy_expand) is almost identical anyway, apart from the
latter setting the headroom (and tailroom).
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt
2016-12-07 9:40 ` Johannes Berg
@ 2016-12-07 9:57 ` Cedric Izoard
0 siblings, 0 replies; 3+ messages in thread
From: Cedric Izoard @ 2016-12-07 9:57 UTC (permalink / raw)
To: Johannes Berg, linux-wireless@vger.kernel.org; +Cc: Laurent Trarieux
PiA+IC0JZndkX3NrYiA9IHNrYl9jb3B5KHNrYiwgR0ZQX0FUT01JQyk7DQo+ID4gKwlpZiAoc2ti
X2hlYWRyb29tKHNrYikgPj0gbG9jYWwtPnR4X2hlYWRyb29tKQ0KPiA+ICsJCWZ3ZF9za2IgPSBz
a2JfY29weShza2IsIEdGUF9BVE9NSUMpOw0KPiA+ICsJZWxzZQ0KPiA+ICsJCWZ3ZF9za2IgPSBz
a2JfY29weV9leHBhbmQoc2tiLCBsb2NhbC0+dHhfaGVhZHJvb20sDQo+ID4gKwkJCQkJwqDCoDAs
IEdGUF9BVE9NSUMpOw0KPiANCj4gV2h5IGJvdGhlciBtYWtpbmcgdGhpcyBjb25kaXRpb25hbD8g
SXQgc2VlbXMgdGhhdCBhbHdheXMgdXNpbmcNCj4gc2tiX2NvcHlfZXhwYW5kKCkgc2hvdWxkIGJl
IHN1ZmZpY2llbnQ/IFRoZSBjb2RlIGJldHdlZW4gdGhlIHR3byAoc2tiX2NvcHksDQo+IHNrYl9j
b3B5X2V4cGFuZCkgaXMgYWxtb3N0IGlkZW50aWNhbCBhbnl3YXksIGFwYXJ0IGZyb20gdGhlIGxh
dHRlciBzZXR0aW5nDQo+IHRoZSBoZWFkcm9vbSAoYW5kIHRhaWxyb29tKS4NCg0KSW5kZWVkLCBj
YWxsaW5nIHNrYl9jb3B5X2V4cGFuZCgpIHdvdWxkIHdvcmsgaW4gYW55IGNhc2UuDQpJIHdpbGwg
c2VuZCBuZXcgcGF0Y2gNCg0KY2VkcmljDQo=
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-07 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06 12:23 [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt Cedric Izoard
2016-12-07 9:40 ` Johannes Berg
2016-12-07 9:57 ` Cedric Izoard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).