summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_iwm.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2022-12-16 13:49:36 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2022-12-16 13:49:36 +0000
commit33cc55479d942f8f08f6b9580855bcc8199730f2 (patch)
treef4952f6f1b7153f874088336b680fb0ee6b9b9e9 /sys/dev/pci/if_iwm.c
parent7ff221bc93640e0f7efe2d79b46edf78464221c9 (diff)
Prevent KASSERT in iwm(4) if firmware image is missing or corrupt.
Same fix as for iwx(4) in CVS commit YakAvDYHWiUF3c4m, r1.113 if_iwx.c. ok deraadt, mpi
Diffstat (limited to 'sys/dev/pci/if_iwm.c')
-rw-r--r--sys/dev/pci/if_iwm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index b7d37d7182e..437a2b9f372 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.404 2022/08/29 17:59:12 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.405 2022/12/16 13:49:35 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -10358,9 +10358,6 @@ iwm_init(struct ifnet *ifp)
generation = ++sc->sc_generation;
- KASSERT(sc->task_refs.r_refs == 0);
- refcnt_init(&sc->task_refs);
-
err = iwm_preinit(sc);
if (err)
return err;
@@ -10374,7 +10371,7 @@ iwm_init(struct ifnet *ifp)
err = iwm_init_hw(sc);
if (err) {
if (generation == sc->sc_generation)
- iwm_stop(ifp);
+ iwm_stop_device(sc);
return err;
}
@@ -10383,6 +10380,8 @@ iwm_init(struct ifnet *ifp)
if (sc->sc_nvm.sku_cap_11ac_enable)
iwm_setup_vht_rates(sc);
+ KASSERT(sc->task_refs.r_refs == 0);
+ refcnt_init(&sc->task_refs);
ifq_clr_oactive(&ifp->if_snd);
ifp->if_flags |= IFF_RUNNING;