Received: by 10.192.165.148 with SMTP id m20csp4583561imm; Tue, 8 May 2018 10:42:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrjHwR15sW6OKpMKcgC+pSIa2RQi+IVcmaJgtn1KJNqwogRISOBD42mnFoxwS7P8s4DbuFN X-Received: by 2002:a17:902:bf45:: with SMTP id u5-v6mr9999728pls.149.1525801335489; Tue, 08 May 2018 10:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525801335; cv=none; d=google.com; s=arc-20160816; b=zxadMXkp6tP4MKN8GAWYlWYYBpq2q1QK7Is1sNCSnDV8RBGP310GMs6/ZtsonKkV9u zVcfIcOXaocDlKWiEIhk9aba9JM5dEnauCUF6ghp8dOOgIHk6nbU/ajGg3U1ixA/1sQp V94FegodXlY2Hkg9WTJ1WmQ6f+oIdp9xxCrMWM6E5UxFzRfK78JG6c7w/3T8Oyh4MQcD xGOF1oaZtBqPG4C5RNY1EsqGIfy0aS2N/fN1IYjiILX6gSSzvqRkkUGE9dWgc/uwHAsE ZzRfSbJRdL4z9CCUaDTuYW8yY9iitdJ6e5OM32pX8Q9tiDJR+BX+UICFJS0AVaUaINMe lC3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CyzlDBzWgAVvhR5+RkH6cpzh0nCWbe34YxwbNPSYVM8=; b=UjNelJoGMqn5NwiLj54YU/TeroEnw8/AlLS/AHngO3XlBdzQHoO6SiyEGx5skJpwvs Yh/v1FZ/8nxgBRteIVVq1nh4smT3pVNwUqwpZ3dMfFuhUhSrfLW3eNCA81zjLLH/A2M8 bNJcqNWdCFrw0i9/gpDMwSmultD02WKz3InSMWDcYqpclJfqltG/u7AyAu4hD9m7+r9D VZ2X+QIAZbUOV0ONTHf79mcy/ERC/ehx//PPpkjsd2qzg3wCR/CMXd8THKBGttF5hzkA lcXLjCidI8jqslbyKoWYxwwFXmJjhk2cm8hayp3HKtjWKrTXdmhG/5IH+oJKNdZVWhLl zfMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si24700473pld.2.2018.05.08.10.42.01; Tue, 08 May 2018 10:42:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755428AbeEHRla (ORCPT + 99 others); Tue, 8 May 2018 13:41:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34138 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755328AbeEHRl2 (ORCPT ); Tue, 8 May 2018 13:41:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B59B98D6EC; Tue, 8 May 2018 17:41:27 +0000 (UTC) Received: from mmorsy.remote.csb (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D256AFD6B; Tue, 8 May 2018 17:41:23 +0000 (UTC) From: Mohammed Gamal To: netdev@vger.kernel.org, sthemmin@microsoft.com Cc: kys@microsoft.com, haiyangz@microsoft.com, devel@linuxdriverproject.org, vkuznets@redhat.com, linux-kernel@vger.kernel.org, Mohammed Gamal Subject: [PATCH] hv_netvsc: Fix net device attach on older Windows hosts Date: Tue, 8 May 2018 19:40:47 +0200 Message-Id: <1525801247-27765-1-git-send-email-mgamal@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 08 May 2018 17:41:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 08 May 2018 17:41:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mgamal@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On older windows hosts the net_device instance is returned to the caller of rndis_filter_device_add() without having the presence bit set first. This would cause any subsequent calls to network device operations (e.g. MTU change, channel change) to fail after the device is detached once, returning -ENODEV. Make sure we explicitly call netif_device_attach() before returning the net_device instance to make sure the presence bit is set Fixes: 7b2ee50c0cd5 ("hv_netvsc: common detach logic") Signed-off-by: Mohammed Gamal --- drivers/net/hyperv/rndis_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 6b127be..09a3c1d 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1287,8 +1287,10 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, rndis_device->hw_mac_adr, rndis_device->link_state ? "down" : "up"); - if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) + if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) { + netif_device_attach(net); return net_device; + } rndis_filter_query_link_speed(rndis_device, net_device); -- 1.8.3.1