]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
hv_netvsc: Add initialization of tx_table in netvsc_device_add()
authorHaiyang Zhang <haiyangz@microsoft.com>
Mon, 14 May 2018 22:32:03 +0000 (15:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:17:26 +0000 (16:17 +0200)
[ Commit 6b0cbe315868d613123cf387052ccda5f09d49ea upstream. ]

tx_table is part of the private data of kernel net_device. It is only
zero-ed out when allocating net_device.

We may recreate netvsc_device w/o recreating net_device, so the private
netdev data, including tx_table, are not zeroed. It may contain channel
numbers for the older netvsc_device.

This patch adds initialization of tx_table each time we recreate
netvsc_device.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/hyperv/netvsc.c

index 03b44ec805db003a6db55ae46c70bb0a22e84d22..73999214d444002a416d28c68f240a8edc7b3f8d 100644 (file)
@@ -1252,6 +1252,9 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
        if (!net_device)
                return ERR_PTR(-ENOMEM);
 
+       for (i = 0; i < VRSS_SEND_TAB_SIZE; i++)
+               net_device_ctx->tx_table[i] = 0;
+
        net_device->ring_size = ring_size;
 
        /* Because the device uses NAPI, all the interrupt batching and