aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-09-05 05:54:00 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-05 12:44:31 -0400
commit7bf6630523a4fddcc3e37bc37dadbe0cf2362354 (patch)
tree812bf8b6a164e43e9eab386cbf332282c736ee44
parent4bfb0513ff203a700f5d17b97b772e8c171549bc (diff)
tuntap: orphan frags before trying to set tx timestamp
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>
-rw-r--r--drivers/net/tun.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2dddb1bc82c9..a639de8401f8 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -749,15 +749,17 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
749 >= dev->tx_queue_len / tun->numqueues) 749 >= dev->tx_queue_len / tun->numqueues)
750 goto drop; 750 goto drop;
751 751
752 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
753 goto drop;
754
752 if (skb->sk) { 755 if (skb->sk) {
753 sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags); 756 sock_tx_timestamp(skb->sk, &skb_shinfo(skb)->tx_flags);
754 sw_tx_timestamp(skb); 757 sw_tx_timestamp(skb);
755 } 758 }
756 759
757 /* Orphan the skb - required as we might hang on to it 760 /* Orphan the skb - required as we might hang on to it
758 * for indefinite time. */ 761 * for indefinite time.
759 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) 762 */
760 goto drop;
761 skb_orphan(skb); 763 skb_orphan(skb);
762 764
763 nf_reset(skb); 765 nf_reset(skb);