Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934994AbcJUP2G (ORCPT ); Fri, 21 Oct 2016 11:28:06 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:56166 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933628AbcJUP2D (ORCPT ); Fri, 21 Oct 2016 11:28:03 -0400 Date: Fri, 21 Oct 2016 11:28:01 -0400 (EDT) Message-Id: <20161021.112801.585243295635293094.davem@davemloft.net> To: vkuznets@redhat.com Cc: netdev@vger.kernel.org, sthemmin@microsoft.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, kys@microsoft.com, haiyangz@microsoft.com Subject: Re: [PATCH net-next] hv_netvsc: fix a race between netvsc_send() and netvsc_init_buf() From: David Miller In-Reply-To: <1476885181-3456-1-git-send-email-vkuznets@redhat.com> References: <1476885181-3456-1-git-send-email-vkuznets@redhat.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 21 Oct 2016 08:28:02 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1070 Lines: 21 From: Vitaly Kuznetsov Date: Wed, 19 Oct 2016 15:53:01 +0200 > Fix in commit 880988348270 ("hv_netvsc: set nvdev link after populating > chn_table") turns out to be incomplete. A crash in > netvsc_get_next_send_section() is observed on mtu change when the device > is under load. The race I identified is: if we get to netvsc_send() after > we set net_device_ctx->nvdev link in netvsc_device_add() but before we > finish netvsc_connect_vsp()->netvsc_init_buf() send_section_map is not > allocated and we crash. Unfortunately we can't set net_device_ctx->nvdev > link after the netvsc_init_buf() call as during the negotiation we need > to receive packets and on the receive path we check for it. It would > probably be possible to split nvdev into a pair of nvdev_in and nvdev_out > links and check them accordingly in get_outbound_net_device()/ > get_inbound_net_device() but this looks like an overkill. > > Check that send_section_map is allocated in netvsc_send(). > > Signed-off-by: Vitaly Kuznetsov Applied, thanks.