Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
	}