public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/hyperv: fix erroneous NETDEV_TX_BUSY use
@ 2012-03-14 18:53 Eric Dumazet
  2012-03-14 18:56 ` Ben Greear
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2012-03-14 18:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, K. Y. Srinivasan, Haiyang Zhang, Greg Kroah-Hartman

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>
---
 drivers/net/hyperv/netvsc_drv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 0f8e834..2517d20 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -167,7 +167,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->vlan_tci = skb->vlan_tci;
@@ -229,7 +229,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;
 }
 
 /*

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-16  9:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 18:53 [PATCH] net/hyperv: fix erroneous NETDEV_TX_BUSY use Eric Dumazet
2012-03-14 18:56 ` Ben Greear
2012-03-14 19:17   ` Eric Dumazet
2012-03-14 20:00     ` Haiyang Zhang
2012-03-14 20:14       ` Eric Dumazet
2012-03-14 20:29         ` Haiyang Zhang
2012-03-16  9:02           ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox