Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2005212imm; Thu, 24 May 2018 04:22:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo4cL7ZWzgW2A+s7SVlXseW4BxACmJkTpQLE0ROrkQBcmaYPkOmUJuKpMv2Bi/UZs6t11j4 X-Received: by 2002:a62:cd45:: with SMTP id o66-v6mr6875258pfg.250.1527160973757; Thu, 24 May 2018 04:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527160973; cv=none; d=google.com; s=arc-20160816; b=x0jlBpg2ChhWfo7aaX/FD2hj2V5MtSAuuX/tas2aVPOlanMx+X0k7nTJg2ys1AqUzj xDPFplXQpFFzbUCB0FpmMG20zhHm9Mry9Ml1GlXsIhlXwJ44524qtPB1AScvQ7ii7QX+ RS0/b66aX2x73WTuKBI8hZGY4OlzOe8Njk33mRgyzGQoOG/5YRK7P8aILkPvZZWzLKY1 Tz746Uo7u7IyJ2jJZcYrNAODrUb4O2O1sqaFr2GBovH8XiYEIuGOttMd8VJeykOjyPTi 244qceObRtei0iPn/0LSitTL8jRNj9K2Sf4V3h7MKAK6+XTRpVtVZROh0VkIBXzkmO29 jl2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mzt1xezCEISljU65SWrBJBTZbIVeVhTu24L+Ywo9iHc=; b=inKnfXQL0Vgihd3Jpe4fJaPTV/vL4KiL2GLbiIk1P52xAsH1WbcTlCxloeSxCn0VJ4 5r01/x2mAC4EI+9NknEb9UEFGswDINcVjiPCBtTwVnGHewbHDjJlwraAf33zNcC5XFrL c93ndKd3QRoEkWiGRiZlG4it+7pd9PBRLkbs8T/DrqDpNlcalduJkYryDE4UWIvOK4ow S0dDl88yBVK9ZvpXFZdFZvkrHak1R4FuBFJ6FLkj8z1c6reQn5hpumRiA6CWFjaALied 5c+KhMnbz3Y4+YyCrjhteZzs0vGmtLyyJRuDkcNkE2nyhcnSHemMZ6KeMbQdqfZYhr3a +SHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=13jKpPnJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7-v6si11646228pgq.121.2018.05.24.04.22.39; Thu, 24 May 2018 04:22:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=13jKpPnJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968789AbeEXLVt (ORCPT + 99 others); Thu, 24 May 2018 07:21:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:51752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967854AbeEXJwY (ORCPT ); Thu, 24 May 2018 05:52:24 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 9BD0920847; Thu, 24 May 2018 09:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155544; bh=/X4+ivrLVdFePZ0o4mQXQ1/kpwOlb45T53bX0JrkNas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=13jKpPnJXIYBuQtRT5abIy3PlgKQpgy2KeG5J9GDt8hG/OXJNPdGm1H2LR5muTzcs tbUDhl2nVuhffELai8X/M8Ro6V5/C6MTw48X2dWnYwleBvaZ08/vrJrSAE4GUagnaF jTtVQDmM2J0zZSDtAVOPhNmcTLWLfHpIjLJGQppA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Hemminger , "David S. Miller" Subject: [PATCH 4.14 027/165] hv_netvsc: disable NAPI before channel close Date: Thu, 24 May 2018 11:37:13 +0200 Message-Id: <20180524093623.079465971@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stephen Hemminger [ Commit 8348e0460ab1473f06c8b824699dd2eed3c1979d upstream. ] This makes sure that no CPU is still process packets when the channel is closed. Fixes: 76bb5db5c749 ("netvsc: fix use after free on module removal") Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/netvsc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -567,6 +567,10 @@ void netvsc_device_remove(struct hv_devi RCU_INIT_POINTER(net_device_ctx->nvdev, NULL); + /* And disassociate NAPI context from device */ + for (i = 0; i < net_device->num_chn; i++) + netif_napi_del(&net_device->chan_table[i].napi); + /* * At this point, no one should be accessing net_device * except in here @@ -578,10 +582,6 @@ void netvsc_device_remove(struct hv_devi netvsc_teardown_gpadl(device, net_device); - /* And dissassociate NAPI context from device */ - for (i = 0; i < net_device->num_chn; i++) - netif_napi_del(&net_device->chan_table[i].napi); - /* Release all resources */ free_netvsc_device_rcu(net_device); }