]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r307518:
authorhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:23:07 +0000 (09:23 +0000)
committerhselasky <hselasky@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 7 Nov 2016 09:23:07 +0000 (09:23 +0000)
commit5eea68dfba8d52eef2794a42de6bfbd0f488010c
tree7eef6a108f87d923224bdb96698bda7fcf65513b
parentf49da9ff0fae76f1c028936292de882aa8160f63
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/9@308403 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
19 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_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