]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r307518:
authorhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:19:04 +0000 (09:19 +0000)
committerhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:19:04 +0000 (09:19 +0000)
commitdd761858bcdd8e44870f72031ba8e1d4af8dd7e9
tree26d7958fa22152e4c57ce0b7e74e168fffdd92a8
parentb61d473a52f8a8f04ec6759aacec78fb059cd5e4
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

git-svn-id: svn://svn.freebsd.org/base/stable/10@308402 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
26 files changed:
sys/arm/allwinner/a10_ehci.c
sys/arm/cavium/cns11xx/ehci_ebus.c
sys/arm/cavium/cns11xx/ohci_ec.c
sys/arm/ti/usb/omap_ehci.c
sys/arm/xilinx/zy7_ehci.c
sys/dev/puc/puc.c
sys/dev/usb/controller/at91dci_atmelarm.c
sys/dev/usb/controller/at91dci_fdt.c
sys/dev/usb/controller/atmegadci_atmelarm.c
sys/dev/usb/controller/dwc_otg_fdt.c
sys/dev/usb/controller/ehci_ixp4xx.c
sys/dev/usb/controller/ehci_mv.c
sys/dev/usb/controller/ehci_pci.c
sys/dev/usb/controller/musb_otg_atmelarm.c
sys/dev/usb/controller/ohci_pci.c
sys/dev/usb/controller/ohci_s3c24x0.c
sys/dev/usb/controller/uhci_pci.c
sys/dev/usb/controller/uss820dci_atmelarm.c
sys/dev/usb/controller/xhci_pci.c
sys/dev/usb/usb_device.c
sys/kern/subr_bus.c
sys/mips/atheros/ar71xx_ehci.c
sys/mips/atheros/ar71xx_ohci.c
sys/mips/cavium/usb/octusb_octeon.c
sys/mips/rmi/xls_ehci.c
sys/mips/rt305x/rt305x_dotg.c