Date: Sat, 2 Dec 2017 01:07:41 +0000 (UTC) From: "Landon J. Fuller" <landonf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326451 - head/sys/dev/bhnd/bhndb Message-ID: <201712020107.vB217fOB059068@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: landonf Date: Sat Dec 2 01:07:41 2017 New Revision: 326451 URL: https://svnweb.freebsd.org/changeset/base/326451 Log: bhndb(4): Fix leak of child devices and MSI vectors. - Add missing call to device_delete_children() in bhndb_detach(), without which we're left with stale child devices on module unload. - Pass the parent PCI device to pci_release_msi(), not the bhndb_pci(4) child. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/bhndb/bhndb.c head/sys/dev/bhnd/bhndb/bhndb_pci.c Modified: head/sys/dev/bhnd/bhndb/bhndb.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb.c Sat Dec 2 00:52:59 2017 (r326450) +++ head/sys/dev/bhnd/bhndb/bhndb.c Sat Dec 2 01:07:41 2017 (r326451) @@ -639,6 +639,10 @@ bhndb_generic_detach(device_t dev) if ((error = bus_generic_detach(dev))) return (error); + /* Delete children */ + if ((error = device_delete_children(dev))) + return (error); + /* Clean up our service registry */ if ((error = bhnd_service_registry_fini(&sc->services))) return (error); Modified: head/sys/dev/bhnd/bhndb/bhndb_pci.c ============================================================================== --- head/sys/dev/bhnd/bhndb/bhndb_pci.c Sat Dec 2 00:52:59 2017 (r326450) +++ head/sys/dev/bhnd/bhndb/bhndb_pci.c Sat Dec 2 01:07:41 2017 (r326451) @@ -303,8 +303,10 @@ bhndb_pci_alloc_msi(struct bhndb_pci_softc *sc, int *m return (error); } - if (count < BHNDB_PCI_MSI_COUNT) + if (count < BHNDB_PCI_MSI_COUNT) { + pci_release_msi(sc->parent); return (ENXIO); + } *msi_count = count; return (0); @@ -412,7 +414,7 @@ cleanup: bhndb_free_intr_isrc(sc->isrc); if (sc->msi_count > 0) - pci_release_msi(dev); + pci_release_msi(sc->parent); if (cores != NULL) free(cores, M_BHND); @@ -449,7 +451,7 @@ bhndb_pci_detach(device_t dev) /* Release MSI interrupts */ if (sc->msi_count > 0) - pci_release_msi(dev); + pci_release_msi(sc->parent); /* Disable PCI bus mastering */ pci_disable_busmaster(sc->parent);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712020107.vB217fOB059068>