summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorEdwin Peer <edwin.peer@broadcom.com>2021-02-05 17:37:32 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-23 13:59:16 +0100
commitc23a7acb08543fa9f9d23aad5a1e8cad64555d81 (patch)
treeb271dfd3f71b743c623f1fb251dc7b1fa3c44754 /include/linux
parent221a2b2f4f8a8dc49033300d1ad7322ffc2ab063 (diff)
downloadlinux-stable-c23a7acb08543fa9f9d23aad5a1e8cad64555d81.tar.gz
linux-stable-c23a7acb08543fa9f9d23aad5a1e8cad64555d81.tar.bz2
linux-stable-c23a7acb08543fa9f9d23aad5a1e8cad64555d81.zip
net: watchdog: hold device global xmit lock during tx disable
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 <edwin.peer@broadcom.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4d1b1056ac97..2aacafe2bce5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3701,6 +3701,7 @@ static inline void netif_tx_disable(struct net_device *dev)
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);
@@ -3708,6 +3709,7 @@ static inline void netif_tx_disable(struct net_device *dev)
netif_tx_stop_queue(txq);
__netif_tx_unlock(txq);
}
+ spin_unlock(&dev->tx_global_lock);
local_bh_enable();
}