From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH net-stable 04/24] hv_netvsc: Add initialization of tx_table in netvsc_device_add() Date: Mon, 14 May 2018 15:32:03 -0700 Message-ID: <20180514223223.25433-5-sthemmin@microsoft.com> References: <20180514223223.25433-1-sthemmin@microsoft.com> Cc: netdev@vger.kernel.org, Haiyang Zhang To: davem@davemloft.net Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:35047 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbeENWch (ORCPT ); Mon, 14 May 2018 18:32:37 -0400 Received: by mail-pl0-f66.google.com with SMTP id i5-v6so8177432plt.2 for ; Mon, 14 May 2018 15:32:37 -0700 (PDT) In-Reply-To: <20180514223223.25433-1-sthemmin@microsoft.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Haiyang Zhang 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 Signed-off-by: David S. Miller --- drivers/net/hyperv/netvsc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 03b44ec805db..73999214d444 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -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 -- 2.17.0