Message ID | 356db1fcf788467f9145abc10e218d66@ceva-dsp.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
> - 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
> > - 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). Indeed, calling skb_copy_expand() would work in any case. I will send new patch cedric
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);
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(-)