Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
hyperv: Fix the error processing in netvsc_send()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
haiyangz authored and davem330 committed Feb 1, 2015
1 parent ecf6ba8 commit d953ca4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device,
u64 req_id;
unsigned int section_index = NETVSC_INVALID_INDEX;
u32 msg_size = 0;
struct sk_buff *skb;
struct sk_buff *skb = NULL;
u16 q_idx = packet->q_idx;


Expand All @@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device,
packet);
skb = (struct sk_buff *)
(unsigned long)packet->send_completion_tid;
if (skb)
dev_kfree_skb_any(skb);
packet->page_buf_cnt = 0;
}
}
Expand Down Expand Up @@ -810,6 +808,13 @@ int netvsc_send(struct hv_device *device,
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;
}

Expand Down

0 comments on commit d953ca4

Please sign in to comment.