]>
Commit | Line | Data |
---|---|---|
a7b0967d MT |
1 | From b3e774263908a834c1c0d5abf3a7658280e42fc7 Mon Sep 17 00:00:00 2001 |
2 | From: KY Srinivasan <kys@microsoft.com> | |
3 | Date: Sun, 28 Sep 2014 22:16:43 -0700 | |
4 | Subject: [PATCH 10/11] hyperv: Fix a bug in netvsc_start_xmit() | |
5 | ||
6 | [ Upstream commit dedb845ded56ded1c62f5398a94ffa8615d4592d ] | |
7 | ||
8 | After the packet is successfully sent, we should not touch the skb | |
9 | as it may have been freed. This patch is based on the work done by | |
10 | Long Li <longli@microsoft.com>. | |
11 | ||
12 | In this version of the patch I have fixed issues pointed out by David. | |
13 | David, please queue this up for stable. | |
14 | ||
15 | Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> | |
16 | Tested-by: Long Li <longli@microsoft.com> | |
17 | Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com> | |
18 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | --- | |
21 | drivers/net/hyperv/netvsc_drv.c | 3 ++- | |
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
23 | ||
24 | diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c | |
25 | index 4fd71b75e666..f15297201777 100644 | |
26 | --- a/drivers/net/hyperv/netvsc_drv.c | |
27 | +++ b/drivers/net/hyperv/netvsc_drv.c | |
28 | @@ -387,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |
29 | int hdr_offset; | |
30 | u32 net_trans_info; | |
31 | u32 hash; | |
32 | + u32 skb_length = skb->len; | |
33 | ||
34 | ||
35 | /* We will atmost need two pages to describe the rndis | |
36 | @@ -562,7 +563,7 @@ do_send: | |
37 | ||
38 | drop: | |
39 | if (ret == 0) { | |
40 | - net->stats.tx_bytes += skb->len; | |
41 | + net->stats.tx_bytes += skb_length; | |
42 | net->stats.tx_packets++; | |
43 | } else { | |
44 | kfree(packet); | |
45 | -- | |
46 | 2.4.3 | |
47 |