ionic_set_coalesce() runs under rtnl only. It saves the new settings, tests LIF_F_UP and writes each queue's interrupt control register in BAR0. A PCI reset clears LIF_F_UP, frees the queues and unmaps BAR0 without rtnl, so an update that passed the test just before the reset reads freed queues and writes the unmapped BAR. The restart after the reset also programs the new queues from the saved settings without rtnl, so it can pick up a half-written update. The teardown and the restart both run under queue_lock, so take it for the whole update. ethtool's ring and channel changes already take queue_lock under rtnl. Found by an AI code review of this series and confirmed by reading the code. Not reproduced, as there is no call between the test and the register write where a test module could hold the update. Tested on an AMD Pensando NIC under KASAN and lockdep with ethtool -C running during 30 PCI resets. Fixes: a79b559e99be ("ionic: add FLR recovery support") Reviewed-by: Brett Creeley Signed-off-by: Nikhil P. Rao --- drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index 1360a3dfb7c6..bc0601dbcf63 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -555,6 +555,8 @@ static int ionic_set_coalesce(struct net_device *netdev, tx_coal > IONIC_INTR_CTRL_COAL_MAX) return -ERANGE; + mutex_lock(&lif->queue_lock); + /* Save the new values */ lif->rx_coalesce_usecs = coalesce->rx_coalesce_usecs; lif->rx_coalesce_hw = rx_coal; @@ -598,6 +600,7 @@ static int ionic_set_coalesce(struct net_device *netdev, } } } + mutex_unlock(&lif->queue_lock); return 0; } -- 2.43.0