diff options
author | 2020-06-17 10:48:44 +0000 | |
---|---|---|
committer | 2020-06-17 10:48:44 +0000 | |
commit | d6d1900fe80088a47f478139234b800bb781dda4 (patch) | |
tree | b56ff5910670c766f6b03ba50d701693408f388f | |
parent | put pci_intr_establish_cpu() in, but commented out for now. (diff) | |
download | wireguard-openbsd-d6d1900fe80088a47f478139234b800bb781dda4.tar.xz wireguard-openbsd-d6d1900fe80088a47f478139234b800bb781dda4.zip |
Remove the bus specific sc_ih (interrup handle) variable and use the common
sc_ih value of struct rl_softc. This fixes a crash in re(4) because
intr_barrier(9) is called with the rl_softc sc_ih which was NULL.
OK kettenis@
-rw-r--r-- | sys/dev/cardbus/if_re_cardbus.c | 13 | ||||
-rw-r--r-- | sys/dev/cardbus/if_rl_cardbus.c | 11 | ||||
-rw-r--r-- | sys/dev/pci/if_re_pci.c | 13 |
3 files changed, 17 insertions, 20 deletions
diff --git a/sys/dev/cardbus/if_re_cardbus.c b/sys/dev/cardbus/if_re_cardbus.c index b6be4899a70..0d744d64cb7 100644 --- a/sys/dev/cardbus/if_re_cardbus.c +++ b/sys/dev/cardbus/if_re_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_cardbus.c,v 1.28 2015/11/24 17:11:39 mpi Exp $ */ +/* $OpenBSD: if_re_cardbus.c,v 1.29 2020/06/17 10:48:44 claudio Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -51,7 +51,6 @@ struct re_cardbus_softc { struct rl_softc sc_rl; /* Cardbus-specific data */ - void *sc_ih; cardbus_devfunc_t ct; pcitag_t sc_tag; pci_chipset_tag_t sc_pc; @@ -140,9 +139,9 @@ re_cardbus_attach(struct device *parent, struct device *self, void *aux) re_cardbus_setup(sc); /* Allocate interrupt */ - csc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, + sc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET, re_intr, sc, sc->sc_dev.dv_xname); - if (csc->sc_ih == NULL) { + if (sc->sc_ih == NULL) { printf(": couldn't establish interrupt at %d", ca->ca_intrline); Cardbus_function_disable(csc->ct); @@ -154,7 +153,7 @@ re_cardbus_attach(struct device *parent, struct device *self, void *aux) /* Call bus-independent (common) attach routine */ if (re_attach(sc, intrstr)) { - cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); + cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, sc->sc_ih); Cardbus_mapreg_unmap(ct, csc->sc_bar_reg, sc->rl_btag, sc->rl_bhandle, csc->sc_mapsize); } @@ -248,8 +247,8 @@ re_cardbus_detach(struct device *self, int flags) if_detach(ifp); /* Disable interrupts */ - if (csc->sc_ih != NULL) - cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); + if (sc->sc_ih != NULL) + cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, sc->sc_ih); /* Free cardbus resources */ Cardbus_mapreg_unmap(ct, csc->sc_bar_reg, sc->rl_btag, sc->rl_bhandle, diff --git a/sys/dev/cardbus/if_rl_cardbus.c b/sys/dev/cardbus/if_rl_cardbus.c index 8cd98f15405..b593a88693d 100644 --- a/sys/dev/cardbus/if_rl_cardbus.c +++ b/sys/dev/cardbus/if_rl_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rl_cardbus.c,v 1.30 2015/11/24 17:11:39 mpi Exp $ */ +/* $OpenBSD: if_rl_cardbus.c,v 1.31 2020/06/17 10:48:44 claudio Exp $ */ /* $NetBSD: if_rl_cardbus.c,v 1.3.8.3 2001/11/14 19:14:02 nathanw Exp $ */ /* @@ -102,7 +102,6 @@ struct rl_cardbus_softc { struct rl_softc sc_rl; /* real rtk softc */ /* CardBus-specific goo. */ - void *sc_ih; cardbus_devfunc_t sc_ct; pci_chipset_tag_t sc_pc; pcitag_t sc_tag; @@ -186,9 +185,9 @@ rl_cardbus_attach(struct device *parent, struct device *self, void *aux) /* * Map and establish the interrupt. */ - csc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET, + sc->sc_ih = cardbus_intr_establish(cc, cf, csc->sc_intrline, IPL_NET, rl_intr, sc, sc->sc_dev.dv_xname); - if (csc->sc_ih == NULL) { + if (sc->sc_ih == NULL) { printf(": couldn't establish interrupt\n"); Cardbus_function_disable(csc->sc_ct); return; @@ -218,8 +217,8 @@ rl_cardbus_detach(struct device *self, int flags) /* * Unhook the interrupt handler. */ - if (csc->sc_ih != NULL) - cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); + if (sc->sc_ih != NULL) + cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, sc->sc_ih); /* * Release bus space and close window. diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index d93caa3adbd..5cc8bd6862b 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.52 2018/04/11 08:02:18 patrick Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.53 2020/06/17 10:48:44 claudio Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -51,7 +51,6 @@ struct re_pci_softc { struct rl_softc sc_rl; /* PCI-specific data */ - void *sc_ih; pci_chipset_tag_t sc_pc; pcitag_t sc_pcitag; @@ -164,9 +163,9 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) return; } intrstr = pci_intr_string(pc, ih); - psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET | IPL_MPSAFE, re_intr, + sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET | IPL_MPSAFE, re_intr, sc, sc->sc_dev.dv_xname); - if (psc->sc_ih == NULL) { + if (sc->sc_ih == NULL) { printf(": couldn't establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); @@ -211,7 +210,7 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) /* Call bus-independent attach routine */ if (re_attach(sc, intrstr)) { - pci_intr_disestablish(pc, psc->sc_ih); + pci_intr_disestablish(pc, sc->sc_ih); bus_space_unmap(sc->rl_btag, sc->rl_bhandle, psc->sc_iosize); } } @@ -236,8 +235,8 @@ re_pci_detach(struct device *self, int flags) if_detach(ifp); /* Disable interrupts */ - if (psc->sc_ih != NULL) - pci_intr_disestablish(psc->sc_pc, psc->sc_ih); + if (sc->sc_ih != NULL) + pci_intr_disestablish(psc->sc_pc, sc->sc_ih); /* Free pci resources */ bus_space_unmap(sc->rl_btag, sc->rl_bhandle, psc->sc_iosize); |