Skip to content

Commit

Permalink
mac80211: fix potentially redundant skb data copying
Browse files Browse the repository at this point in the history
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 <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Dec 20, 2010
1 parent 4cd06a3 commit f8a0a78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f8a0a78

Please sign in to comment.