From: stsp Date: Fri, 16 Dec 2022 13:49:35 +0000 (+0000) Subject: Prevent KASSERT in iwm(4) if firmware image is missing or corrupt. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=af25dd1799e11923cc3ccdba8faba2436fe60f26;p=openbsd 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 --- 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 @@ -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;