]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tuntap: orphan frags before trying to set tx timestamp
authorJason Wang <jasowang@redhat.com>
Thu, 5 Sep 2013 09:54:00 +0000 (17:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Sep 2013 16:44:31 +0000 (12:44 -0400)
sock_tx_timestamp() will clear all zerocopy flags of skb which may lead the
frags never to be orphaned. This will break guest to guest traffic when zerocopy
is enabled. Fix this by orphaning the frags before trying to set tx time stamp.

The issue were introduced by commit eda297729171fe16bf34fe5b0419dfb69060f623
(tun: Support software transmit time stamping).

Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c

index 2dddb1bc82c90bae632de357a95227b4a2af6684..a639de8401f8741ce7325b5261fe9c42ee377be7 100644 (file)
@@ -749,15 +749,17 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
                          >= dev->tx_queue_len / tun->numqueues)
                goto drop;
 
                          >= dev->tx_queue_len / tun->numqueues)
                goto drop;
 
+       if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
+               goto drop;
+
        if (skb->sk) {
                sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags);
                sw_tx_timestamp(skb);
        }
 
        /* Orphan the skb - required as we might hang on to it
        if (skb->sk) {
                sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags);
                sw_tx_timestamp(skb);
        }
 
        /* Orphan the skb - required as we might hang on to it
-        * for indefinite time. */
-       if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
-               goto drop;
+        * for indefinite time.
+        */
        skb_orphan(skb);
 
        nf_reset(skb);
        skb_orphan(skb);
 
        nf_reset(skb);