diff options
author | Haiyang Zhang <haiyangz@microsoft.com> | 2015-01-29 15:34:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-31 20:31:49 -0500 |
commit | d953ca4ddf71aa91a4596b2ff7ff1598f6ad4708 (patch) | |
tree | 34a8edb843776b391f51fa844955d2b65ba6d712 /drivers/net/hyperv | |
parent | ecf6ba83d76e0c78e89401750dc527008e14faa2 (diff) |
hyperv: Fix the error processing in netvsc_send()
The existing code frees the skb in EAGAIN case, in which the skb will be
retried from upper layer and used again.
Also, the existing code doesn't free send buffer slot in error case, because
there is no completion message for unsent packets.
This patch fixes these problems.
(Please also include this patch for stable trees. Thanks!)
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r-- | drivers/net/hyperv/netvsc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 9f49c0129a78..7cd4eb38abfa 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device, | |||
716 | u64 req_id; | 716 | u64 req_id; |
717 | unsigned int section_index = NETVSC_INVALID_INDEX; | 717 | unsigned int section_index = NETVSC_INVALID_INDEX; |
718 | u32 msg_size = 0; | 718 | u32 msg_size = 0; |
719 | struct sk_buff *skb; | 719 | struct sk_buff *skb = NULL; |
720 | u16 q_idx = packet->q_idx; | 720 | u16 q_idx = packet->q_idx; |
721 | 721 | ||
722 | 722 | ||
@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device, | |||
743 | packet); | 743 | packet); |
744 | skb = (struct sk_buff *) | 744 | skb = (struct sk_buff *) |
745 | (unsigned long)packet->send_completion_tid; | 745 | (unsigned long)packet->send_completion_tid; |
746 | if (skb) | ||
747 | dev_kfree_skb_any(skb); | ||
748 | packet->page_buf_cnt = 0; | 746 | packet->page_buf_cnt = 0; |
749 | } | 747 | } |
750 | } | 748 | } |
@@ -810,6 +808,13 @@ int netvsc_send(struct hv_device *device, | |||
810 | packet, ret); | 808 | packet, ret); |
811 | } | 809 | } |
812 | 810 | ||
811 | if (ret != 0) { | ||
812 | if (section_index != NETVSC_INVALID_INDEX) | ||
813 | netvsc_free_send_slot(net_device, section_index); | ||
814 | } else if (skb) { | ||
815 | dev_kfree_skb_any(skb); | ||
816 | } | ||
817 | |||
813 | return ret; | 818 | return ret; |
814 | } | 819 | } |
815 | 820 | ||