Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5074004pxb; Mon, 15 Feb 2021 08:50:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5o1CmwtHsSAq7UCInxuCDzzvdLD/uqtXEKlble4xlQD1Yoqd8BDZmEN4TcF98aujqrBWH X-Received: by 2002:a05:6402:1d27:: with SMTP id dh7mr16233050edb.338.1613407814314; Mon, 15 Feb 2021 08:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407814; cv=none; d=google.com; s=arc-20160816; b=fugVQc6Sc6U5K4ezyy3xDe6TI30DLal4oiAakueQvSaiR/OUVrXcZ3TW91XGXgTlJH cTG+MWgGSDtTgAjkrIDPxBDEvZaExZPEKe+LUwTa6CK/jFjMF874dM7Zi8jqCcJJULfC Jo7gvU/C6n5DY4YOPySLcjTI3iJH0kiC9DQgr0nWS+yDaUjt5q0MkCNHrWmFX3YvK+3l o/40NBwEwZiYPxLgxEDpX+ysutH3OqFQhFNNAQ57ORFBuX4ANHV0dJ85ApUmLII7CLUz UyJBK8R/jdlC//Hz1ftuYSL5Uz4KIUEU3aOus9RGNNGe4K+JP++TBXm6p57SPShGh33k uyRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4SQnWtpjPnrH0jfsjVp+VNZsBBaKu+yN7t8b+cwWyiE=; b=Kjkfw6+vXq4zmqQOZFuy4iWP2JQiNNRM4vgZmtL8T+wJI+FZVwigvMBWhy3qRnsBWy vd4qVSgT8Dvm2+SbMvVHoTvUX7UpxQF8N9+nVRHxoW12sffTF+FnJ4elmbHcpiQB1BJe jb/cd/1aW+uUFHYRnG9C3bszSNFao1jNcmgjC/qZ93hTj4sO9tktdDCSaNnv7eXuq3gO MPSwpypHq0hS5mXMRLNVOLOTglf0aJUR6VCAmtL9ucZNAqM+mOGD8jHuf0eLbt3ORK+s 2mG7J+CbhWbSvHbPXyiKL8KvKdJJ97lRKwmCayjWY4swbqAswdiYWZhY8/eyk5HAjMRQ /z4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C8KtXwEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si12095574eji.503.2021.02.15.08.49.50; Mon, 15 Feb 2021 08:50:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C8KtXwEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbhBOQsm (ORCPT + 99 others); Mon, 15 Feb 2021 11:48:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:50360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231280AbhBOPiR (ORCPT ); Mon, 15 Feb 2021 10:38:17 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD40B64E52; Mon, 15 Feb 2021 15:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403281; bh=IbIM3s9XuvyiMOjFVmDrWo1VkIC6GberW/nW619dT8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8KtXwEz39YjusyaGutK6qwv7KKMUdddmcxAat1i423zqzxAkmMDfDwOdVAby26CW TjaRfN11WLUaOirSRJVY2mBmxf8jrWs44A2YnXQ7Er7BOrjenYeVPguw+ugyA74ze8 yw7EZv84HFtD2wWmCZ5C4L4ffTCbEihYotQDW1uM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edwin Peer , Jakub Kicinski , "David S. Miller" Subject: [PATCH 5.10 096/104] net: watchdog: hold device global xmit lock during tx disable Date: Mon, 15 Feb 2021 16:27:49 +0100 Message-Id: <20210215152722.567168205@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Edwin Peer commit 3aa6bce9af0e25b735c9c1263739a5639a336ae8 upstream. Prevent netif_tx_disable() running concurrently with dev_watchdog() by taking the device global xmit lock. Otherwise, the recommended: netif_carrier_off(dev); netif_tx_disable(dev); driver shutdown sequence can happen after the watchdog has already checked carrier, resulting in possible false alarms. This is because netif_tx_lock() only sets the frozen bit without maintaining the locks on the individual queues. Fixes: c3f26a269c24 ("netdev: Fix lockdep warnings in multiqueue configurations.") Signed-off-by: Edwin Peer Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/linux/netdevice.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4313,6 +4313,7 @@ static inline void netif_tx_disable(stru local_bh_disable(); cpu = smp_processor_id(); + spin_lock(&dev->tx_global_lock); for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq = netdev_get_tx_queue(dev, i); @@ -4320,6 +4321,7 @@ static inline void netif_tx_disable(stru netif_tx_stop_queue(txq); __netif_tx_unlock(txq); } + spin_unlock(&dev->tx_global_lock); local_bh_enable(); }