]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/linux/0011-hyperv-Fix-a-bug-in-netvsc_send.patch
core117: Regenerate language cache
[ipfire-2.x.git] / src / patches / linux / 0011-hyperv-Fix-a-bug-in-netvsc_send.patch
1 From 26875bba869bd91a1d8fef9229a56a1e6d9fef2b Mon Sep 17 00:00:00 2001
2 From: KY Srinivasan <kys@microsoft.com>
3 Date: Sun, 5 Oct 2014 10:42:51 -0700
4 Subject: [PATCH 11/11] hyperv: Fix a bug in netvsc_send()
5
6 [ Upstream commit 3a67c9ccad926a168d8b7891537a452018368a5b ]
7
8 After the packet is successfully sent, we should not touch the packet
9 as it may have been freed. This patch is based on the work done by
10 Long Li <longli@microsoft.com>.
11
12 David, please queue this up for stable.
13
14 Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
15 Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 ---
19 drivers/net/hyperv/netvsc.c | 15 ++++++++-------
20 1 file changed, 8 insertions(+), 7 deletions(-)
21
22 diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
23 index d97d5f39a04e..7edf976ecfa0 100644
24 --- a/drivers/net/hyperv/netvsc.c
25 +++ b/drivers/net/hyperv/netvsc.c
26 @@ -708,6 +708,7 @@ int netvsc_send(struct hv_device *device,
27 unsigned int section_index = NETVSC_INVALID_INDEX;
28 u32 msg_size = 0;
29 struct sk_buff *skb;
30 + u16 q_idx = packet->q_idx;
31
32
33 net_device = get_outbound_net_device(device);
34 @@ -772,24 +773,24 @@ int netvsc_send(struct hv_device *device,
35
36 if (ret == 0) {
37 atomic_inc(&net_device->num_outstanding_sends);
38 - atomic_inc(&net_device->queue_sends[packet->q_idx]);
39 + atomic_inc(&net_device->queue_sends[q_idx]);
40
41 if (hv_ringbuf_avail_percent(&out_channel->outbound) <
42 RING_AVAIL_PERCENT_LOWATER) {
43 netif_tx_stop_queue(netdev_get_tx_queue(
44 - ndev, packet->q_idx));
45 + ndev, q_idx));
46
47 if (atomic_read(&net_device->
48 - queue_sends[packet->q_idx]) < 1)
49 + queue_sends[q_idx]) < 1)
50 netif_tx_wake_queue(netdev_get_tx_queue(
51 - ndev, packet->q_idx));
52 + ndev, q_idx));
53 }
54 } else if (ret == -EAGAIN) {
55 netif_tx_stop_queue(netdev_get_tx_queue(
56 - ndev, packet->q_idx));
57 - if (atomic_read(&net_device->queue_sends[packet->q_idx]) < 1) {
58 + ndev, q_idx));
59 + if (atomic_read(&net_device->queue_sends[q_idx]) < 1) {
60 netif_tx_wake_queue(netdev_get_tx_queue(
61 - ndev, packet->q_idx));
62 + ndev, q_idx));
63 ret = -ENOSPC;
64 }
65 } else {
66 --
67 2.4.3
68