Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1613762ybv; Fri, 21 Feb 2020 00:18:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwadJN+NvVl3DdddeFt9MsiCritqWghGU5ZW283D1ruMpzXFgkUPQkC1Q4TYxDROm7BkweT X-Received: by 2002:a9d:7cd9:: with SMTP id r25mr25537743otn.326.1582273089946; Fri, 21 Feb 2020 00:18:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273089; cv=none; d=google.com; s=arc-20160816; b=cqz6teMvoM707pIqq66bj8xc3eJB6D6cXUpYylgETuGl7HlyUC8dGqPx+xl+Bq7aZg fnPne7pEAQ3lXmt96ft9B6sMlA5IbioolDJcO1od84s6CybgClmy0RLDCIgjN7IQ2B3G rokEeNSLXOnVrdgUnH7xupF1kKFrY8db1C2xE0TelR28IFiuxrdOPIcuo6yEWFTZ/J71 tBRtw6aPfCoP2vCBe28UsOOOuFxr7jzuDu/sOMJLXmNSf1U/13b63M+pfl7xMd7RdQC5 pniLtHBgFCaAJn6bs5ZTyR+jn8m3XkOoZ02tGF7O85pXJQSgNDnDwUBBP7HxqL1NtNCv 4DCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FOsv40Ru+i0nDq+Lf5LbHtbPTk13xLN+X5vKnfILEdk=; b=U6C3Vyi31j/mPzqsK9aAiS2G3hJUhfqc8B2gjUMkClydICkcHLU9NtRHkt1h0xN2V4 UbvI2c64YDPP9xyetlychwIGioNcmwz3uf7OKGiLb/5H8HzSRKpXQSpuGdkcMm/2xF9U uE70tVggoeAucCxFYEbSpagmOzy+5k20B5WIFbtDprNC5YARnc1pxCalKTdgF0e5sSw4 dFhmvbaEJ60/S+PVrM2vVq+Q7IZeMfEyxuoiNqoT2IS3N3/We+6mtkwSdFVcjM5/q0L9 raXrZsAWBBmNs5ipD4WELIqRgWDhHL/i15QdNlLuMoMQ0YIc/lkLrsLXyi/bA5NowA3f vTIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CQO/zbgQ"; 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 x207si436505oif.193.2020.02.21.00.17.57; Fri, 21 Feb 2020 00:18:09 -0800 (PST) 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="CQO/zbgQ"; 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 S2387562AbgBUIQl (ORCPT + 99 others); Fri, 21 Feb 2020 03:16:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:53796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733247AbgBUIQk (ORCPT ); Fri, 21 Feb 2020 03:16:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 17D6524682; Fri, 21 Feb 2020 08:16:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272999; bh=oqTT/1FyUaTJRtLSIyaPrRGQSsQSWyhw0sE6xLLLCFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQO/zbgQGNaBBH/8+PS0PxcpHofXE05nDPfv0T2V1yF+ekA5hY7vG+pq2lt2A77lT C3M8wUxQaDzsUkBtPRE9fMKlKdhGpfqqYLWUcQvy5qyTaLT2PnO4iiTMkrUMOj3zmd 9qI98t7umWAY1AKlGbMVuZBmLeHgsgXkWeUdJo6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Firo Yang , "David S. Miller" Subject: [PATCH 4.19 002/191] enic: prevent waking up stopped tx queues over watchdog reset Date: Fri, 21 Feb 2020 08:39:35 +0100 Message-Id: <20200221072251.022364530@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Firo Yang [ Upstream commit 0f90522591fd09dd201065c53ebefdfe3c6b55cb ] Recent months, our customer reported several kernel crashes all preceding with following message: NETDEV WATCHDOG: eth2 (enic): transmit queue 0 timed out Error message of one of those crashes: BUG: unable to handle kernel paging request at ffffffffa007e090 After analyzing severl vmcores, I found that most of crashes are caused by memory corruption. And all the corrupted memory areas are overwritten by data of network packets. Moreover, I also found that the tx queues were enabled over watchdog reset. After going through the source code, I found that in enic_stop(), the tx queues stopped by netif_tx_disable() could be woken up over a small time window between netif_tx_disable() and the napi_disable() by the following code path: napi_poll-> enic_poll_msix_wq-> vnic_cq_service-> enic_wq_service-> netif_wake_subqueue(enic->netdev, q_number)-> test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state) In turn, upper netowrk stack could queue skb to ENIC NIC though enic_hard_start_xmit(). And this might introduce some race condition. Our customer comfirmed that this kind of kernel crash doesn't occur over 90 days since they applied this patch. Signed-off-by: Firo Yang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -2013,10 +2013,10 @@ static int enic_stop(struct net_device * napi_disable(&enic->napi[i]); netif_carrier_off(netdev); - netif_tx_disable(netdev); if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) for (i = 0; i < enic->wq_count; i++) napi_disable(&enic->napi[enic_cq_wq(enic, i)]); + netif_tx_disable(netdev); if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic)) enic_dev_del_station_addr(enic);