From: Felix Fietkau Date: Sat, 18 Dec 2010 18:30:50 +0000 (+0100) Subject: mac80211: fix potentially redundant skb data copying X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f8a0a781488ec7288d1049e5d2022850aa98f7b6;p=openwrt%2Fstaging%2Fblogic.git mac80211: fix potentially redundant skb data copying When an skb is shared, it needs to be duplicated, along with its data buffer. If the skb does not have enough headroom, using skb_copy might cause the data buffer to be copied twice (once by skb_copy and once by pskb_expand_head). Fix this by using skb_clone initially and letting ieee80211_skb_resize sort out the rest. Signed-off-by: Felix Fietkau Signed-off-by: John W. Linville --- diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 90ee23550033..d2b4b67a7b53 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1934,7 +1934,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, */ if (skb_shared(skb)) { tmp_skb = skb; - skb = skb_copy(skb, GFP_ATOMIC); + skb = skb_clone(skb, GFP_ATOMIC); kfree_skb(tmp_skb); if (!skb) {