summaryrefslogtreecommitdiffstats
path: root/sys/arm/allwinner
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2016-11-07 08:36:06 +0000
committerhselasky <hselasky@FreeBSD.org>2016-11-07 08:36:06 +0000
commitea512fc24698cb90f6b4456e0a76fba1ca994e3a (patch)
tree54be7a70e07f49ecc9474f9c6f165a7812292e09 /sys/arm/allwinner
parent7fa1d4ac3f1e9c0244c9fea96875bb5b6b0bc8ce (diff)
downloadFreeBSD-src-ea512fc24698cb90f6b4456e0a76fba1ca994e3a.zip
FreeBSD-src-ea512fc24698cb90f6b4456e0a76fba1ca994e3a.tar.gz
MFC r307518:
Fix device delete child function. When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester <me@janh.de> Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070
Diffstat (limited to 'sys/arm/allwinner')
-rw-r--r--sys/arm/allwinner/a10_ehci.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/sys/arm/allwinner/a10_ehci.c b/sys/arm/allwinner/a10_ehci.c
index accf7f9..f754c9a 100644
--- a/sys/arm/allwinner/a10_ehci.c
+++ b/sys/arm/allwinner/a10_ehci.c
@@ -278,17 +278,11 @@ a10_ehci_detach(device_t self)
struct aw_ehci_softc *aw_sc = device_get_softc(self);
ehci_softc_t *sc = &aw_sc->sc;
const struct aw_ehci_conf *conf;
- device_t bdev;
int err;
uint32_t reg_value = 0;
conf = USB_CONF(self);
- if (sc->sc_bus.bdev) {
- bdev = sc->sc_bus.bdev;
- device_detach(bdev);
- device_delete_child(self, bdev);
- }
/* during module unload there are lots of children leftover */
device_delete_children(self);
OpenPOWER on IntegriCloud