Commit 313b037c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

gianfar: fix potential sk_wmem_alloc imbalance

commit db83d136 (gianfar: Fix missing sock reference when
processing TX time stamps) added a potential sk_wmem_alloc imbalance

If the new skb has a different truesize than old one, we can get a
negative sk_wmem_alloc once new skb is orphaned at TX completion.

Now we no longer early orphan skbs in dev_hard_start_xmit(), this
probably can lead to fatal bugs.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Tested-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Cc: Manfred Rudigier <manfred.rudigier@omicron.at>
Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Cc: Jiajun Wu <b06378@freescale.com>
Cc: Andy Fleming <afleming@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 022f0978
......@@ -2063,10 +2063,9 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
/* Steal sock reference for processing TX time stamps */
swap(skb_new->sk, skb->sk);
swap(skb_new->destructor, skb->destructor);
kfree_skb(skb);
if (skb->sk)
skb_set_owner_w(skb_new, skb->sk);
consume_skb(skb);
skb = skb_new;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment