From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB2DC3F2D1 for ; Tue, 3 Mar 2020 18:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B90F2214D8 for ; Tue, 3 Mar 2020 18:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258798; bh=3ZksyE+x5cTFHGDdxLkl57aHEzfo6Y3b4uDTj2f8a0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OVlusMjxIoyl6L35LmOgCeEr76e6TeVdem4zeoObN6kXAsrKJxU7YUBPoYaORf4yq ecEPi1DtejcrZGi2Y27fDq+KjOpiYM/2qlo18PqO5gHag5qlFT3CI1N2YwmMx8jpjD rVP2TwISEncpI6dW++IY3J73hLuFOe5btGhJBHaM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732929AbgCCSGf (ORCPT ); Tue, 3 Mar 2020 13:06:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:38408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732592AbgCCR4U (ORCPT ); Tue, 3 Mar 2020 12:56:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A1060206D5; Tue, 3 Mar 2020 17:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258179; bh=3ZksyE+x5cTFHGDdxLkl57aHEzfo6Y3b4uDTj2f8a0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vrw79tlv35tB5DBgoEMxWeKSGqmj0JS6KOwWJOalsaykOU/WX41QsD+gZYtZnbbjP wLxmCdIAEVhsco0ZYQWIGW3ZGZXVyZl8CqAsY1MXeeBjKB7tcfOQuvs9ZYzeBh0spw SdjXX7ALkKx2huW5qDe8h9jSphzz/+WZC39//4jQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haiyang Zhang , "David S. Miller" Subject: [PATCH 5.4 102/152] hv_netvsc: Fix unwanted wakeup in netvsc_attach() Date: Tue, 3 Mar 2020 18:43:20 +0100 Message-Id: <20200303174314.173454019@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174302.523080016@linuxfoundation.org> References: <20200303174302.523080016@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Haiyang Zhang commit f6f13c125e05603f68f5bf31f045b95e6d493598 upstream. When netvsc_attach() is called by operations like changing MTU, etc., an extra wakeup may happen while netvsc_attach() calling rndis_filter_device_add() which sends rndis messages when queue is stopped in netvsc_detach(). The completion message will wake up queue 0. We can reproduce the issue by changing MTU etc., then the wake_queue counter from "ethtool -S" will increase beyond stop_queue counter: stop_queue: 0 wake_queue: 1 The issue causes queue wake up, and counter increment, no other ill effects in current code. So we didn't see any network problem for now. To fix this, initialize tx_disable to true, and set it to false when the NIC is ready to be attached or registered. Fixes: 7b2ee50c0cd5 ("hv_netvsc: common detach logic") Signed-off-by: Haiyang Zhang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -99,7 +99,7 @@ static struct netvsc_device *alloc_net_d init_waitqueue_head(&net_device->wait_drain); net_device->destroy = false; - net_device->tx_disable = false; + net_device->tx_disable = true; net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -973,6 +973,7 @@ static int netvsc_attach(struct net_devi } /* In any case device is now ready */ + nvdev->tx_disable = false; netif_device_attach(ndev); /* Note: enable and attach happen when sub-channels setup */ @@ -2350,6 +2351,8 @@ static int netvsc_probe(struct hv_device else net->max_mtu = ETH_DATA_LEN; + nvdev->tx_disable = false; + ret = register_netdevice(net); if (ret != 0) { pr_err("Unable to register netdev.\n");