Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5043010pxb; Mon, 15 Feb 2021 08:05:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwovs4mGuL9JZFF/VgcA57R5USVVBHaEI4vawXCRPwG3wPrcGi+cAtepv2sBq4OAg2JeU1g X-Received: by 2002:a17:907:20a8:: with SMTP id pw8mr16619199ejb.9.1613405118592; Mon, 15 Feb 2021 08:05:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613405118; cv=none; d=google.com; s=arc-20160816; b=LT2p7FMTO+K74fqcPXhfXHlucngmHfwfQDAn9U1GxJiFc6S2X8ZCUvCwcVQ2MuYRvt H1vCXXQ3QJTw7NnObox6KL6rrbqD09SbSrGJVF8XPOLtMMYj/3hCKIiR/9XHaTSOSyA9 ZwJYMujrZBUsrzgJLF6ttzREH5uHlawysD1UhRaRII9tM2HuP2WMCbaib3th+uI26s1E mUUXSLak+r5f4CV0Tr2Op89oYz26oKEWG2L/e0Kp9SwDSYZxyJnzBjclgqEVo35I7teX FvLNCY7ySMPQ28vBevvK3VdK4TpVTU1In9+TpHzo2dXOmk707juEaHB1qLTY9Q+BlUOB 5htg== 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=o0gilyN2TMFsYoKpYWmSKfykaEYLg9utEtgBmHmtSe8=; b=FN3mISwOMHIuupH3+9MLxdaJY16H+8LMKGWQ0u0qA3cOfwZ6T5ORRg7emCUjNQ+imP HfxRlSf6j6d1iHMQoqi1awh4Kygp60tj93iZGJLqU+klYMcKeesAijqeU4bNsVudSCG+ OeqtE/TncmTWL6rDzo+63wjD3WGDFsv2eS/o7aqSOJpwej+oksbyZh2w7qrEMmu0WIQZ oarm87CQ5Lot340AdIspk+JdreJ+7ueeYrY4ExamFjlOAmznTicPBT/8kX4oAk/hgkNJ EHouZ/2LC0sTnuk5UpLbdn7Atqscr2BhbNr+tptkh3BhznK4Mo77rfrOS7+4n+yw5tLG 8D0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aMWCOhNP; 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 zm12si6593786ejb.707.2021.02.15.08.04.54; Mon, 15 Feb 2021 08:05:18 -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=aMWCOhNP; 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 S232827AbhBOQDs (ORCPT + 99 others); Mon, 15 Feb 2021 11:03:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:47012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231371AbhBOPdE (ORCPT ); Mon, 15 Feb 2021 10:33:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D6CAA64E52; Mon, 15 Feb 2021 15:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403038; bh=klZW4V3EPZDlo0Bsg6QbybOANQ4eI5sriq/4SYKrtqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aMWCOhNP/B++fku1k0gnN6gWdxm6s19ex6xHKF0UfKYdAX/VzaA4zxHqpTymeVUS6 fl46BffocyyV46U03Zh5giHCdI7/+jWOzrerwLpsiIu5gdVQaYagm31y36gYA4XgJ/ RsTQvXrpzU88HIwvFBU/fNRNGg/TedQLVO/H0ZBE= 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.4 55/60] net: watchdog: hold device global xmit lock during tx disable Date: Mon, 15 Feb 2021 16:27:43 +0100 Message-Id: <20210215152717.142354296@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@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 @@ -4044,6 +4044,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); @@ -4051,6 +4052,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(); }