Received: by 10.192.165.156 with SMTP id m28csp1174681imm; Wed, 11 Apr 2018 13:55:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Vj7pHYi7FMz7Dg3xTOcsuA1DJONlUZzUpcWK5lNX/yAoQU3NOzHC+lRTxmMLqZI90Tzzm X-Received: by 10.98.234.13 with SMTP id t13mr5318717pfh.56.1523480131344; Wed, 11 Apr 2018 13:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523480131; cv=none; d=google.com; s=arc-20160816; b=FcbKvjnh8GD35TAQvWCKSz65/anNF2mtyYJVYwZOWqbZuBDyFtQzKdl6VOVGvBEtlU gIS3ij/ByIuDegeBIz84qEFRElJt66skDeWfOIR69cHz8bRh75Ghrpfc+lnOG3w+KXOy mP8AVyWfgsJGG7YPcQIXDjmRAYz+TA7WprjHdc4rOmcKLVFul6Z5Wh9TEwG6a9FtkLKx y8c9i13VHbKtORmw8VnM5xXcJsoFEY7oxgq05V6CC9JWb347Misv4zsre4VY7ID2xbKc UAWODs2n635f+dMn3pbntbuVNZ411//ZUcONdBr9P+oeCajautF4/Jc6Vhw+hjJbYDay VVxg== 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=KX5UZXrS+5So/h1A8CqaKtc7RmHUqxuG0XO9Oa0bX1E=; b=SwI7eaUnoKDTAJk0NowhzBfZ07QwLD+7D/KSrUrSTfArVAT3MPpKxN+wNYy4L2+J32 g6Ql/ooggNoVP5n8IrR3ZGfgUg/VTiNC4eGNsAXnE9vR5SORVZw0Ya1WQBV+CIHt3JSp rMqOp9i44FAyHq9+aTMAKnf99QjNE2/eiNphevXJ/zvi5XzMBOSAoQAqOoC5umR+2k6f 92r4CAUDakBo3NRTAo/1FKyQWsfeJibMdeC0tKwDnHL/TgVJ+kX0eCQbbRofNUlYs/+o FQNeW2+tVkJxm8r7EP0BLk0ZvE81Cgz/b0Xsil/nBxMJyfW4Z4Q5NqbobbrT6AP4ptw0 58MA== 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 l85si1406860pfb.231.2018.04.11.13.54.54; Wed, 11 Apr 2018 13:55:31 -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 S1755700AbeDKSqJ (ORCPT + 99 others); Wed, 11 Apr 2018 14:46:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58814 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754877AbeDKSqH (ORCPT ); Wed, 11 Apr 2018 14:46:07 -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 42B08D20; Wed, 11 Apr 2018 18:46:06 +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 4.4 027/190] vmxnet3: ensure that adapter is in proper state during force_close Date: Wed, 11 Apr 2018 20:34:33 +0200 Message-Id: <20180411183551.763375258@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@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.4-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 @@ -2789,6 +2789,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); }