Skip to content

Commit

Permalink
hyperv: Fix a bug in netvsc_start_xmit()
Browse files Browse the repository at this point in the history
After the packet is successfully sent, we should not touch the skb
as it may have been freed. This patch is based on the work done by
Long Li <longli@microsoft.com>.

In this version of the patch I have fixed issues pointed out by David.
David, please queue this up for stable.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Long Li <longli@microsoft.com>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
KY Srinivasan authored and David S. Miller committed Sep 30, 2014
1 parent c5bb86c commit dedb845
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
int hdr_offset;
u32 net_trans_info;
u32 hash;
u32 skb_length = skb->len;


/* We will atmost need two pages to describe the rndis
Expand Down Expand Up @@ -562,7 +563,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)

drop:
if (ret == 0) {
net->stats.tx_bytes += skb->len;
net->stats.tx_bytes += skb_length;
net->stats.tx_packets++;
} else {
kfree(packet);
Expand Down

0 comments on commit dedb845

Please sign in to comment.