K 10 svn:author V 3 ian K 8 svn:date V 27 2021-10-06T16:10:32.263953Z K 7 svn:log V 851 Fix busdma resource leak on usb device detach. When a usb device is detached, usb_pc_dmamap_destroy() called bus_dmamap_destroy() while the map was still loaded. That's harmless on x86 architectures, but on all other platforms it causes bus_dmamap_destroy() to return EBUSY and leak away any memory resources (including bounce buffers) associated with the mapping, as well as any allocated map structure itself. This change introduces a new is_loaded flag to the usb_page_cache struct to track whether a map is loaded or not. If the map is loaded, bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking away resources. Differential Revision: https://reviews.freebsd.org/D32208 (cherry picked from commit dc91a9715f8fda4b3633388830a28a99f73cbe59) Git Hash: 6fea4b82e7b86ac680d5615f8361863353737325 Git Author: ian@FreeBSD.org END