From: Edwin Peer Date: Sat, 6 Feb 2021 01:37:32 +0000 (-0800) Subject: net: watchdog: hold device global xmit lock during tx disable X-Git-Tag: v4.14.222~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8d403a809c8f3e0dda2c1ff22d3ffad015349b02;p=users%2Fdwmw2%2Flinux.git 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 Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3512c337a4a6b..80579577a7005 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3674,6 +3674,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); @@ -3681,6 +3682,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(); }