From bdcf1fa01dccf775a49e2ea19a1a437c38667255 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 22 Sep 2022 04:37:23 +0000 Subject: [PATCH] aq(4): Don't schedule tick callout on interrupt if stopping. Make sure to take the lock around access to sc_detect_linkstat too. --- sys/dev/pci/if_aq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/if_aq.c b/sys/dev/pci/if_aq.c index f6e1ab7da91e..b48ba300d5ad 100644 --- a/sys/dev/pci/if_aq.c +++ b/sys/dev/pci/if_aq.c @@ -3976,8 +3976,11 @@ aq_legacy_intr(void *arg) AQ_WRITE_REG(sc, AQ_INTR_STATUS_CLR_REG, 0xffffffff); if (status & __BIT(sc->sc_linkstat_irq)) { + AQ_LOCK(sc); sc->sc_detect_linkstat = true; - callout_schedule(&sc->sc_tick_ch, 0); + if (!sc->sc_stopping) + callout_schedule(&sc->sc_tick_ch, 0); + AQ_UNLOCK(sc); nintr++; } @@ -4029,8 +4032,11 @@ aq_link_intr(void *arg) status = AQ_READ_REG(sc, AQ_INTR_STATUS_REG); if (status & __BIT(sc->sc_linkstat_irq)) { + AQ_LOCK(sc); sc->sc_detect_linkstat = true; - callout_schedule(&sc->sc_tick_ch, 0); + if (!sc->sc_stopping) + callout_schedule(&sc->sc_tick_ch, 0); + AQ_UNLOCK(sc); AQ_WRITE_REG(sc, AQ_INTR_STATUS_CLR_REG, __BIT(sc->sc_linkstat_irq)); nintr++;