summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2022-02-08 14:24:37 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2022-02-08 14:24:37 +0000
commit509b19f8bbbfb93f512ad04e79a10b349f3a9f3c (patch)
treef91b43717389911ad7c2da92f6f47857e4d23081 /sys/dev/pci
parent9d20d697e3fa98ad27edb3aba874491ecee002ab (diff)
Fix a KASSERT in iwm(4) being triggered for the wrong reason.
iwm_wakeup() must initialize the task reference counter only if resuming the device succeeds. Otherwise, the newstate task will not be scheduled and hence the ref counter must remain at zero. Problem observed by + ok kettenis@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_iwm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 5e0af5f824d..26d48bf5b80 100644
--- a/sys/dev/pci/if_iwm.c
+++ b/sys/dev/pci/if_iwm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.390 2022/01/21 15:51:02 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.391 2022/02/08 14:24:36 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -11719,8 +11719,6 @@ iwm_wakeup(struct iwm_softc *sc)
struct ifnet *ifp = &sc->sc_ic.ic_if;
int err;
- refcnt_init(&sc->task_refs);
-
err = iwm_start_hw(sc);
if (err)
return err;
@@ -11729,6 +11727,7 @@ iwm_wakeup(struct iwm_softc *sc)
if (err)
return err;
+ refcnt_init(&sc->task_refs);
ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;