From: Alan Stern > Sent: 14 December 2015 15:28 ... > I thought of something else, a more serious problem. According to the > man page for munmap(2), closing the file descriptor does not unmap the > region. Therefore we need to explicitly make sure that the usbcore > module cannot be unloaded while any memory mappings exist, by calling > try_module_get(THIS_MODULE) when a mapping is created and > module_put(THIS_MODULE) when a mapping is removed.
Are you sure this is a problem? It is more likely that either: 1) the mmap() holds a reference to the physical pages - so they don't get freed even though the driver frees its reference to the memory. 2) when the driver frees the memory the user-space page tables are invalidated - so the next access generates EFAULT. Not that I've done the experiment (or tried to read the code). If you need to monitor the mapping, you need to allow for partial unmaps. David -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html