On Mon, 14 Dec 2015, Steinar H. Gunderson wrote:

> On Mon, Dec 14, 2015 at 04:41:24PM +0800, Peter Chen wrote:
> >> +  ret = usbfs_increase_memory_usage(size + sizeof(struct usb_memory));
> >> +  if (ret) {
> >> +          return ret;
> >> +  }
> > The braces are not needed.
> 
> New patch attached.

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.

Alan Stern

--
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

Reply via email to