]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r307518:
authorhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:27:05 +0000 (09:27 +0000)
committerhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:27:05 +0000 (09:27 +0000)
commit028d9e66a61dae0d4d5b0b1229f3f04c72b3f597
tree1ab2c6826a789c108c9500816e5dfea1840845e7
parent150790be396cc542e07688e859290c30923eb1d6
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/8@308404 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
16 files changed:
sys/dev/puc/puc.c
sys/dev/usb/controller/at91dci_atmelarm.c
sys/dev/usb/controller/atmegadci_atmelarm.c
sys/dev/usb/controller/ehci_ixp4xx.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/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