Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c23a7acb authored by Edwin Peer's avatar Edwin Peer Committed by Greg Kroah-Hartman
Browse files

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: c3f26a26 ("netdev: Fix lockdep warnings in multiqueue configurations.")
Signed-off-by: default avatarEdwin Peer <edwin.peer@broadcom.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 221a2b2f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -3701,6 +3701,7 @@ static inline void netif_tx_disable(struct net_device *dev)


	local_bh_disable();
	local_bh_disable();
	cpu = smp_processor_id();
	cpu = smp_processor_id();
	spin_lock(&dev->tx_global_lock);
	for (i = 0; i < dev->num_tx_queues; i++) {
	for (i = 0; i < dev->num_tx_queues; i++) {
		struct netdev_queue *txq = netdev_get_tx_queue(dev, 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_stop_queue(txq);
		__netif_tx_unlock(txq);
		__netif_tx_unlock(txq);
	}
	}
	spin_unlock(&dev->tx_global_lock);
	local_bh_enable();
	local_bh_enable();
}
}