Received: by 10.192.165.156 with SMTP id m28csp1063597imm; Wed, 11 Apr 2018 11:44:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/l0K1YXUm1S45hVFKsrUU9aW3Uuc04836ktN6XuUx23r6cAgBJaMDFUizj0DLuGYMD9Yz7 X-Received: by 10.101.73.2 with SMTP id p2mr4140676pgs.397.1523472283264; Wed, 11 Apr 2018 11:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523472283; cv=none; d=google.com; s=arc-20160816; b=qTQi7R5la0w5BePHo452USRGg8MCoSD1EAo925ztjNarfpP4znGcY9Rrch4Z8MZSat mm6w08e5DAoblg0wmqUQ6dd2L6AoZFVwX9xXy0YDZ1zHeQmnwT8I9+FApn3ie4586+7r C1j+McVTTqPR8R9BtZW8hnjCHcz+1Fl6z8jbnaoxWrtwydYQ/2AE0iFD7IgQc8rvQMu0 xNXBHKAJm9987KIFgLuEPZmwED/VQ6+Fn+iicJkGDtkARKGKEd3O2fQWnQbaiP9NxJAV eAdTvvCNTHaGArL2C3j5U2bB2j10lLE6x8YtafW0U/Br4DPU7nUD6QhcmlI/JGyrhUI5 KOhw== 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 :arc-authentication-results; bh=2oB4jU2eIJXZxHfGYqsrcCDiEdCsgoQGdBZuESJtjt4=; b=V0uZkkUxsvOrlopADcZwa5xPyEabtceD46MWUyKClaF5ovW7teMcIr3h+jA4frdP9Y XxZqrhq3fHZal3ImyBBXmjTk2MemFp8rLjZezN1TMJASv+CBcUAEeUlFYjPB9GHrovpK QS2Cxinug+/UeaRnsPSUG253CVGX/sGhp43LTydTS5E3gQ3DzFshC2SNCYj2a6QI5JMh 7q+pwTUWVL3RbNQum8ZiqKxhDMX1TcrD2YqNdHjEmCDQrJS+XnZgFv+sVG4k9gygdseB 6JmpDozwKAydpbWHLvrEcc/lIEQTdZ620HjpmK5UqJM6SebwxwUKz6RIkI1M4dfmITkJ eatg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si1128030pgf.358.2018.04.11.11.44.06; Wed, 11 Apr 2018 11:44:43 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754538AbeDKSj7 (ORCPT + 99 others); Wed, 11 Apr 2018 14:39:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56246 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754467AbeDKSjz (ORCPT ); Wed, 11 Apr 2018 14:39:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F2C9DAD9; Wed, 11 Apr 2018 18:39:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Horman , Shrikrishna Khare , "VMware, Inc." , "David S. Miller" , Sasha Levin Subject: [PATCH 3.18 016/121] vmxnet3: ensure that adapter is in proper state during force_close Date: Wed, 11 Apr 2018 20:35:19 +0200 Message-Id: <20180411183457.148275052@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183456.195010921@linuxfoundation.org> References: <20180411183456.195010921@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Neil Horman [ Upstream commit 1c4d5f51a812a82de97beee24f48ed05c65ebda5 ] There are several paths in vmxnet3, where settings changes cause the adapter to be brought down and back up (vmxnet3_set_ringparam among them). Should part of the reset operation fail, these paths call vmxnet3_force_close, which enables all napi instances prior to calling dev_close (with the expectation that vmxnet3_close will then properly disable them again). However, vmxnet3_force_close neglects to clear VMXNET3_STATE_BIT_QUIESCED prior to calling dev_close. As a result vmxnet3_quiesce_dev (called from vmxnet3_close), returns early, and leaves all the napi instances in a enabled state while the device itself is closed. If a device in this state is activated again, napi_enable will be called on already enabled napi_instances, leading to a BUG halt. The fix is to simply enausre that the QUIESCED bit is cleared in vmxnet3_force_close to allow quesence to be completed properly on close. Signed-off-by: Neil Horman CC: Shrikrishna Khare CC: "VMware, Inc." CC: "David S. Miller" Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/vmxnet3/vmxnet3_drv.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -2648,6 +2648,11 @@ vmxnet3_force_close(struct vmxnet3_adapt /* we need to enable NAPI, otherwise dev_close will deadlock */ for (i = 0; i < adapter->num_rx_queues; i++) napi_enable(&adapter->rx_queue[i].napi); + /* + * Need to clear the quiesce bit to ensure that vmxnet3_close + * can quiesce the device properly + */ + clear_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); dev_close(adapter->netdev); }