Commit d953ca4d authored by Haiyang Zhang's avatar Haiyang Zhang Committed by David S. Miller

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: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ecf6ba83
...@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device, ...@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device,
u64 req_id; u64 req_id;
unsigned int section_index = NETVSC_INVALID_INDEX; unsigned int section_index = NETVSC_INVALID_INDEX;
u32 msg_size = 0; u32 msg_size = 0;
struct sk_buff *skb; struct sk_buff *skb = NULL;
u16 q_idx = packet->q_idx; u16 q_idx = packet->q_idx;
...@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device, ...@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device,
packet); packet);
skb = (struct sk_buff *) skb = (struct sk_buff *)
(unsigned long)packet->send_completion_tid; (unsigned long)packet->send_completion_tid;
if (skb)
dev_kfree_skb_any(skb);
packet->page_buf_cnt = 0; packet->page_buf_cnt = 0;
} }
} }
...@@ -810,6 +808,13 @@ int netvsc_send(struct hv_device *device, ...@@ -810,6 +808,13 @@ int netvsc_send(struct hv_device *device,
packet, ret); packet, ret);
} }
if (ret != 0) {
if (section_index != NETVSC_INVALID_INDEX)
netvsc_free_send_slot(net_device, section_index);
} else if (skb) {
dev_kfree_skb_any(skb);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment