net/hyperv: fix erroneous NETDEV_TX_BUSY use
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 14 Mar 2012 08:53:34 +0000 (08:53 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Mar 2012 09:01:17 +0000 (02:01 -0700)
A driver start_xmit() method cannot free skb and return NETDEV_TX_BUSY,
since caller is going to reuse freed skb.

This is mostly a revert of commit bf769375c (staging: hv: fix the return
status of netvsc_start_xmit())

In fact netif_tx_stop_queue() / netif_stop_queue() is needed before
returning NETDEV_TX_BUSY or you can trigger a ksoftirqd fatal loop.

In case of memory allocation error, only safe way is to drop the packet
and return NETDEV_TX_OK

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c

index bf01841bda5bb78e1e8378480d98d948541c9c3c..610860f28968a4460aaa63d5004cd69d668216aa 100644 (file)
@@ -166,7 +166,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 
                dev_kfree_skb(skb);
                net->stats.tx_dropped++;
-               return NETDEV_TX_BUSY;
+               return NETDEV_TX_OK;
        }
 
        packet->extension = (void *)(unsigned long)packet +
@@ -226,7 +226,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
                dev_kfree_skb_any(skb);
        }
 
-       return ret ? NETDEV_TX_BUSY : NETDEV_TX_OK;
+       return NETDEV_TX_OK;
 }
 
 /*